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

asyncpg execute return is not passed #8

Closed
euri10 opened this issue Jan 20, 2020 · 5 comments
Closed

asyncpg execute return is not passed #8

euri10 opened this issue Jan 20, 2020 · 5 comments

Comments

@euri10
Copy link

euri10 commented Jan 20, 2020

greetings, amazing library I'm discovering so bear with me maybe I'm misusing it.

should I use asyncpg directly this way, the response will be CREATE DATABASE

dbpool = await get_db_pool(database_subscriber_dsn)
# response = await create_queries.create_db_test(dbpool)
response = await dbpool.execute("create database postgres_test;")

now should I try it with aiosql with the following sql file it returns None

-- name: create_db_test#
create database postgres_test;

happy to send a little PR

@nackjicholson
Copy link
Owner

What is on the response object that you need? None of the adapters return from execute_script. I think my assumption was that if you're defining a script, you just want it to run and you don't need anything back.

@euri10
Copy link
Author

euri10 commented Jan 22, 2020

I'm creating database, schema, and copy_to_table I'm used to postgesql letting me know it was successful with stuff like this for instance

dsn: PostgresDsn = get_app_settings().dsn
    conn = await asyncpg.connect(dsn)
    response = await conn.execute("create database postgres_test;")
    await conn.close()
    assert response == "CREATE DATABASE"

@nackjicholson
Copy link
Owner

@euri10 Hey thanks for the info. Sorry it's been so long since I've been able to come back and look at this project. I'm hoping to review this soon. Need to put it on my TODO list :)

Thank you so much for taking the time to help identify this improvement.

@nackjicholson
Copy link
Owner

For psycopg2 this would use: https://www.psycopg.org/docs/cursor.html#cursor.statusmessage

Not sure it has an analog for the sqlite3 drivers.

@nackjicholson
Copy link
Owner

It does not have an analog for sqlite drivers unfortunately. But I am just returning a string "DONE" for those drivers. This is done @euri10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants