-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix alembic migration scripts and tests, add additional custom test
- Loading branch information
1 parent
de058eb
commit 6be4f36
Showing
9 changed files
with
93 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
from alembic import op | ||
from sqlalchemy import engine_from_config | ||
from sqlalchemy.engine import reflection | ||
import sqlalchemy | ||
|
||
|
||
def table_exists(table_name): | ||
config = op.get_context().config | ||
engine = engine_from_config(config.get_section(config.config_ini_section), prefix="sqlalchemy.") | ||
inspector = reflection.Inspector.from_engine(engine) | ||
engine = config.attributes.get("connection", None) | ||
if engine is None: | ||
engine = engine_from_config(config.get_section(config.config_ini_section), prefix="sqlalchemy.") | ||
inspector = sqlalchemy.inspect(engine) | ||
tables = inspector.get_table_names() | ||
return table_name in tables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.