Questions tagged [aiopg]

A Python library for accessing a PostgreSQL database using asyncio.

aiopg wraps asynchronous features of the Psycopg database driver.

30 questions
0
votes
2 answers

psycopg2.errors.SyntaxError: syntax error at or near "["

I am trying to execute simple query using sqlalchemy that basically just uses the IN clause in sql Below is the query select(Model).where(Model.column_name.in_(["test", "test1"])) Below is the error i get psycopg2.errors.SyntaxError: syntax error…
ALTAF HUSSAIN
  • 205
  • 2
  • 13
0
votes
0 answers

NotImplementedError asynchronous

I'm trying to use fastapi connect to Postgresql with async,but I got a NotimplementError, It's seems the coderecord = await objects.get(test5, orderId=result['orderId']) cause this problem. but I don't know how to fixed it there is some solution…
timber
  • 1
0
votes
1 answer

Does aiopg async with engine.acquire() close connection?

Lame question here. When running async with engine.acquire() as conn: await conn.execute(...) will the context manager close connection automatically? And does it imply that postgres connection will be closed too?
mr_bulrathi
  • 514
  • 7
  • 23
0
votes
3 answers

How to make IN expression an optional parameter if empty list of elements was provided?

I would like to make IN statement an optional part of my sql query if empty list was provided as argument, but failed to to it. I can do workaround and use some default value in code instead of empty list (all cam_ids), but I would like to know how…
Artiom Kozyrev
  • 3,526
  • 2
  • 13
  • 31
0
votes
1 answer

Run two asynco loop in a python script (telethon, aiopg)

I would like to use Telethon (Telegram bot) and aiopg (PostgreSQL) library. Telethon example: from telethon import TelegramClient api_id = 12345 api_hash = '0123456789abcdef0123456789abcdef' client = TelegramClient('anon', api_id, api_hash) async…
santrom
  • 3
  • 3
0
votes
1 answer

How to fix aiopg exception on initialization engine in aiohttp application?

I'm studying aiohttp using official documentation and on step where I must get database connection the code raises exception. I have a function and call it with: app.on_startup.append(function) like in the documentation. Function's code is…
0
votes
1 answer

Value substitution using encode/databases fecthall method

I'm using encode/databases(https://www.encode.io/databases/database_queries/) which has been configured to connect using postgresql+aiopg://DBUSER:DBPASS@1.2.3.4:1234/SOMEDB Take the following function: async def get_table_sample(table_name: str,…
0
votes
1 answer

Can't check if user exist in Postgres DB aiohttp

Here you can see model of User with its methods class User: def __init__(self, db, data, *kw): self.db = db self.username = data[0] self.pass_hash = argon2.argon2_hash(data[1], salt=b'salty salt') async def…
Lilly
  • 59
  • 1
  • 1
  • 9
0
votes
1 answer

How to insert composite primary key using SQLAlchemy?

When I try to insert the composite primary key connection returns 0 rows: CompetitionRound = sa.Table('CompetitionRound', metadata, sa.Column('CompetitionId', sa.Integer, sa.ForeignKey('Competitions.Id'),…
Denis Kotov
  • 857
  • 2
  • 10
  • 29
0
votes
1 answer

Filtering across related models with SQLAlchemy core API (using AIOPG)

I'm trying to do something I'm fairly sure is simple using AIOPG, which can use sqlalchemy's core API. My SQL is not great, so that's where I'm falling down here. models class School(Base): __tablename__ = 'schools' id = Column(Integer,…
0
votes
1 answer

Is there an asyncio-friendly version for presto

I know that there exists a package called aiopg for working with Postgresql in asyncio-friendly connections. Is there a similar version/package for Presto? I'm trying to implement concurrency for querying in Presto connections in Python. Thanks in…
0
votes
0 answers

How to use aiopg together with aiohttp

I have an application that loops through batches of URL:s from a Postgres table, downloads the URL, runs a processing function on each download and saves back the result of the processing to the table. I have written it using aiopg and aiohttp to…
Gustav
  • 109
  • 9
0
votes
1 answer

Python aiopg lastrowid

I'm using asyncio and aiopg and after INSERT execute I can't get lastrowid. My code: async with aiopg.create_pool(self.connect, loop=self._loop) as pool: async with pool.acquire() as connect: async with connect.cursor() as cursor: …
0
votes
1 answer

Copy_from not working in aiopg

Here's a query that I'm trying to execute in aiopg and the data. I have no idea why it fails. The script works fine, except the table has no rows in it. If I comment the drop table line, it raises an exception (table already exists). If I drop the…
culebrón
  • 34,265
  • 20
  • 72
  • 110
-1
votes
1 answer

TypeError: __init__() takes 5 positional arguments error while creating aiopg Pool

I have written the below code for some unit testing. Wondering if someone can point me in the right direction.I know I am missing somthing but cant figure it out. class testing(tornado.testing.AsyncHTTPTestCase): def setUp(self): …
Gurgii
  • 11
  • 2
1
2