File tree 4 files changed +20
-5
lines changed
4 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ docs/_build/
12
12
dist /
13
13
.venv /
14
14
.cache /
15
+ .mypy_cache /
15
16
16
17
.idea /
17
18
pip-wheel-metadata
Original file line number Diff line number Diff line change
1
+ [mypy]
2
+ python_version = 3.6
3
+ warn_return_any = True
4
+ warn_unused_configs = True
5
+
6
+ # Ignore no stubs for modules like psycopg2 etc
7
+ ignore_missing_imports = True
8
+
9
+ # Allow reusing the same variable with multiple assignments of different types.
10
+ allow_redefinition = True
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ pylint = "^2.4"
38
38
black = { version = " *" , allows-prereleases = true }
39
39
pre-commit = " ^1.18"
40
40
httpretty = " ^0.9.6"
41
+ mypy = " ^0.720"
41
42
42
43
[tool .poetry .extras ]
43
44
ingestion = [" pandas" , " sqlalchemy" ]
Original file line number Diff line number Diff line change 21
21
from splitgraph .core .image_manager import ImageManager
22
22
from splitgraph .core .sql import validate_import_sql
23
23
from splitgraph .engine .postgres .engine import PostgresEngine
24
- from splitgraph .exceptions import CheckoutError , EngineInitializationError
24
+ from splitgraph .exceptions import CheckoutError , EngineInitializationError , TableNotFoundError
25
25
from ._common import (
26
26
manage_audit_triggers ,
27
27
set_head ,
@@ -1013,11 +1013,14 @@ def table_exists_at(
1013
1013
) -> bool :
1014
1014
"""Determines whether a given table exists in a Splitgraph image without checking it out. If `image_hash` is None,
1015
1015
determines whether the table exists in the current staging area."""
1016
- return (
1016
+ if image is None :
1017
1017
repository .object_engine .table_exists (repository .to_schema (), table_name )
1018
- if image is None
1019
- else bool (image .get_table (table_name ))
1020
- )
1018
+ else :
1019
+ try :
1020
+ image .get_table (table_name )
1021
+ return True
1022
+ except TableNotFoundError :
1023
+ return False
1021
1024
1022
1025
1023
1026
def _sync (
You can’t perform that action at this time.
0 commit comments