Skip to content

Commit

Permalink
Pin requirement versions and fix default sync period (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
gouline authored Aug 19, 2022
1 parent 229bc4f commit c88b2a1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions dbtmetabase/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,8 @@ def config(ctx, inspect: bool = False, resolve: bool = False, env: bool = False)
)
if config_file["metabase_sync"]:
config_file["metabase_sync_timeout"] = click.prompt(
"Synchronization timeout in seconds. If set, we will fail hard on synchronization failure; \nIf set to 0 or a negative number, we will proceed after attempting sync regardless of success",
default=config_file.get("metabase_sync_timeout", -1),
"Synchronization timeout in seconds. If set, we will fail hard on synchronization failure; \nIf set to 0, we will proceed after attempting sync regardless of success",
default=config_file.get("metabase_sync_timeout", 0),
show_default=True,
value_proc=lambda i: None if int(i) <= 0 else int(i),
type=click.INT,
Expand Down
9 changes: 3 additions & 6 deletions dbtmetabase/metabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@ def sync_and_wait(
Arguments:
database {str} -- Metabase database name.
models {list} -- List of dbt models read from project.
Keyword Arguments:
timeout {int} -- Timeout before giving up in seconds. (default: {30})
timeout {int} -- Timeout before giving up in seconds.
Returns:
bool -- True if schema compatible with models, false if still incompatible.
Expand All @@ -111,11 +109,10 @@ def sync_and_wait(
- the database cannot be found
- a timeout was provided but sync was unsuccessful
"""
if timeout is None:
allow_sync_failure = False
if not timeout:
timeout = 30
allow_sync_failure = True
else:
allow_sync_failure = False

if timeout < self._SYNC_PERIOD_SECS:
raise exceptions.MetabaseUnableToSync(
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PyYAML
requests
click
rich
PyYAML>=5.4.1
requests>=2.26.0
click>=8.0.0
rich>=12.0.0

0 comments on commit c88b2a1

Please sign in to comment.