-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from proteanhq/4-rename-repository-to-adapter-a…
…nd-enrich-for-domain-model 4 Rename `Repository` to `Adapter` and enrich for domain model
- Loading branch information
Showing
5 changed files
with
77 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,4 +130,7 @@ output/*/index.html | |
*.bak | ||
|
||
# VS Code | ||
.vscode | ||
.vscode | ||
|
||
# Redis file | ||
dump.rdb |
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,22 +1,22 @@ | ||
""" Utility functions for the Protean Sqlalchemy Package """ | ||
from protean.core.repository import repo | ||
from protean.core.repository import repo_factory | ||
from sqlalchemy.orm.session import Session | ||
|
||
from protean_sqlalchemy.repository import SqlalchemySchema | ||
from protean_sqlalchemy.repository import SqlalchemyModel | ||
|
||
|
||
def create_tables(): | ||
""" Create tables for all registered entities""" | ||
|
||
for conn_name, conn in repo.connections.items(): | ||
for conn_name, conn in repo_factory.connections.items(): | ||
if isinstance(conn, Session): | ||
SqlalchemySchema.metadata.create_all(conn.bind) | ||
SqlalchemyModel.metadata.create_all(conn.bind) | ||
|
||
|
||
def drop_tables(): | ||
""" Drop tables for all registered entities""" | ||
|
||
# Delete all the tables | ||
for conn_name, conn in repo.connections.items(): | ||
for conn_name, conn in repo_factory.connections.items(): | ||
if isinstance(conn, Session): | ||
SqlalchemySchema.metadata.drop_all(conn.bind) | ||
SqlalchemyModel.metadata.drop_all(conn.bind) |
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.