diff --git a/sqlalchemy_utils/functions/database.py b/sqlalchemy_utils/functions/database.py index 392aab03..9613e126 100644 --- a/sqlalchemy_utils/functions/database.py +++ b/sqlalchemy_utils/functions/database.py @@ -458,12 +458,7 @@ def sqlite_file_exists(database): return header[:16] == b'SQLite format 3\x00' url = copy(make_url(url)) - database = url.database - if url.drivername.startswith('postgres'): - url.database = 'postgres' - else: - url.database = None - + database, url.database = url.database, None engine = sa.create_engine(url) if engine.dialect.name == 'postgresql':