Skip to content

Commit 6470696

Browse files
Update for SQLAlchemy 1.4+ compatibility.
`postgres://...` no longer accepted in connection url, must be `postgresql://...`
1 parent 1f348ee commit 6470696

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

example/manage.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
import time
1515
from typing import Any, Optional, Generator, List, Tuple
1616

17-
from migra import Migration # type: ignore
17+
from migra import Migration
1818
from psycopg2 import connect, OperationalError # type: ignore
1919
from psycopg2 import sql
2020
from psycopg2.sql import Composed
21-
from sqlbag import ( # type: ignore
21+
from sqlbag import (
2222
S,
2323
load_sql_from_folder)
2424

@@ -170,13 +170,13 @@ def _get_schema_diff(
170170
def _temp_db(host: str, user: str, password: str) -> Generator[str, Any, Any]:
171171
"""Create, yield, & remove a temporary database as context."""
172172
connection = _resilient_connect(
173-
f'postgres://{user}:{password}@{host}/{DB_NAME}')
173+
f'postgresql://{user}:{password}@{host}/{DB_NAME}')
174174
connection.set_session(autocommit=True)
175175
name = _temp_name()
176176

177177
with connection.cursor() as cursor:
178178
_create_db(cursor, name)
179-
yield f'postgres://{user}:{password}@{host}/{name}'
179+
yield f'postgresql://{user}:{password}@{host}/{name}'
180180
_drop_db(cursor, name)
181181

182182
connection.close()

0 commit comments

Comments
 (0)