Skip to content

Commit

Permalink
Update for SQLAlchemy 1.4+ compatibility.
Browse files Browse the repository at this point in the history
`postgres://...` no longer accepted in connection url, must be
`postgresql://...`
  • Loading branch information
andrew-chang-dewitt committed May 6, 2021
1 parent 1f348ee commit 6470696
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions example/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
import time
from typing import Any, Optional, Generator, List, Tuple

from migra import Migration # type: ignore
from migra import Migration
from psycopg2 import connect, OperationalError # type: ignore
from psycopg2 import sql
from psycopg2.sql import Composed
from sqlbag import ( # type: ignore
from sqlbag import (
S,
load_sql_from_folder)

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

with connection.cursor() as cursor:
_create_db(cursor, name)
yield f'postgres://{user}:{password}@{host}/{name}'
yield f'postgresql://{user}:{password}@{host}/{name}'
_drop_db(cursor, name)

connection.close()
Expand Down

0 comments on commit 6470696

Please sign in to comment.