Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support AsyncPG #5154

Open
p-null opened this issue Jul 20, 2020 · 6 comments
Open

Support AsyncPG #5154

p-null opened this issue Jul 20, 2020 · 6 comments
Labels
area/ysql Yugabyte SQL (YSQL) community/request Issues created by external users kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue

Comments

@p-null
Copy link

p-null commented Jul 20, 2020

Jira Link: DB-1359
Hi,

I am using asyncpg as database driver for my python application.

Currently, it will break on split_server_version_string() in asyncpg library: inside that function it will get version_string, and convert each part of that string to int. While YugabyteDB returns the version_string containing strings that cant be converted to int. In my case, it's '11.2-YB-2.2.0.0-b0'

A minimum example to reproduce:

import asyncio
import asyncpg

async def run():
    conn = await asyncpg.connect(user='1234',
                                 password='1234',
                                 database='1234',
                                 host='1234,
                                 port=1234)
    values = await conn.execute('''SELECT name, age, language FROM employee WHERE id = 1''')
    print(values)
    await conn.close()

loop = asyncio.get_event_loop()
loop.run_until_complete(run())
@yugabyte-ci yugabyte-ci added the community/request Issues created by external users label Jul 20, 2020
@ddorian ddorian added the area/ysql Yugabyte SQL (YSQL) label Jul 20, 2020
@p-null
Copy link
Author

p-null commented Jul 20, 2020

The purpose of this function( get_server_version) is to get the version of PostgreSQL server originally. It will let asyncpg choose the appropriate driver to connect with PostgreSQL server.

So here I think the purpose is to get YugabyteDB's PosrgreSQL version, like which version of PostgreSQL that YB is using.

@tedyu
Copy link
Contributor

tedyu commented Jul 20, 2020

Within '11.2-YB-2.2.0.0-b0', the 11.2 is the corresponding Postgres version.

@stevebang
Copy link
Contributor

See related blog post: 1M rows/s from Postgres to Python

@andyondrya
Copy link

Hey there. Something up to date on this thread, I'm having the same issue with Yugabyte running on a kubernetes cluster, would I define it something like this?

conn = await asyncpg.connect(user='1234',
                                 password='1234',
                                 database='1234',
                                 host='1234,
                                 port=1234)
conn = conn.get_server_version()```

@sycured
Copy link

sycured commented Jan 10, 2021

Have you any fix?

@andyondrya
Copy link

I kinda figured out the issue when I rebuilt the wheel after editing serverversion.py

@yugabyte-ci yugabyte-ci added kind/bug This issue is a bug priority/medium Medium priority issue labels Jun 8, 2022
@yugabyte-ci yugabyte-ci added kind/enhancement This is an enhancement of an existing feature and removed kind/bug This issue is a bug labels Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL) community/request Issues created by external users kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue
Projects
Status: No status
Development

No branches or pull requests

8 participants