Update SQLAlchemy compatibility and dependencies
- Added psycopg2-binary to requirements for PostgreSQL support. - Refactored consumer.py to use joinedload with the correct syntax. - Updated models.py to fix ForeignKey and Enum type definitions for better compatibility with current SQLAlchemy versions. These changes ensure the application is compatible with the latest SQLAlchemy practices and supports PostgreSQL databases.
This commit is contained in:
parent
2afbf652dc
commit
6ea2a00bfe
|
|
@ -5,3 +5,4 @@ aiohttp_jinja2
|
|||
aiohttp
|
||||
sqlalchemy
|
||||
logbook
|
||||
psycopg2-binary
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ class Consumer:
|
|||
await asyncio.gather(*fetches)
|
||||
session.commit()
|
||||
|
||||
jobs = [self.process_job(job, session) for job in session.query(Job).options(joinedload('user'))]
|
||||
jobs = [self.process_job(job, session) for job in session.query(Job).options(joinedload(Job.user))]
|
||||
await asyncio.gather(*jobs)
|
||||
session.commit()
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ class Job(Base):
|
|||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
article = Column(Integer)
|
||||
title = Column(String)
|
||||
user_name = Column(Integer, ForeignKey("user.name"))
|
||||
format = Column(Enum('pdf', 'mobi', 'epub'))
|
||||
user_name = Column(String, ForeignKey("user.name"))
|
||||
format = Column(Enum('pdf', 'mobi', 'epub', name='format_enum'))
|
||||
|
||||
|
||||
class ContextSession:
|
||||
|
|
|
|||
Loading…
Reference in New Issue