-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
163 additions
and
82 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 |
---|---|---|
|
@@ -6,6 +6,9 @@ on: | |
branches: | ||
- master | ||
|
||
env: | ||
PY_COLORS: 1 | ||
|
||
jobs: | ||
linters: | ||
runs-on: ubuntu-latest | ||
|
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
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,14 +1,16 @@ | ||
from django.db import connections | ||
|
||
|
||
def is_table_exists(table_name: str, using: str = 'default') -> bool: | ||
def is_table_exists(table_name: str, using: str = "default") -> bool: | ||
with connections[using].cursor() as cursor: | ||
return table_name in connections[using].introspection.table_names(cursor) | ||
|
||
|
||
def is_view_exists(view_name: str, using: str = 'default') -> bool: | ||
def is_view_exists(view_name: str, using: str = "default") -> bool: | ||
with connections[using].cursor() as cursor: | ||
views = [ | ||
table.name for table in connections[using].introspection.get_table_list(cursor) if table.type == 'v' | ||
table.name | ||
for table in connections[using].introspection.get_table_list(cursor) | ||
if table.type == "v" | ||
] | ||
return view_name in views |
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.