We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fd0a2b5 commit c4dc113Copy full SHA for c4dc113
1 file changed
server/app/database.py
@@ -5,6 +5,12 @@
5
# Default to SQLite for local development
6
DATABASE_URL = os.getenv("DATABASE_URL", "sqlite+aiosqlite:///./test.db")
7
8
+# Render provides postgres:// but SQLAlchemy async needs postgresql+asyncpg://
9
+if DATABASE_URL.startswith("postgres://"):
10
+ DATABASE_URL = DATABASE_URL.replace("postgres://", "postgresql+asyncpg://", 1)
11
+elif DATABASE_URL.startswith("postgresql://"):
12
+ DATABASE_URL = DATABASE_URL.replace("postgresql://", "postgresql+asyncpg://", 1)
13
+
14
engine = create_async_engine(
15
DATABASE_URL,
16
echo=True,
0 commit comments