diff --git a/dbtmetabase/__init__.py b/dbtmetabase/__init__.py index 89705741..18bafdce 100644 --- a/dbtmetabase/__init__.py +++ b/dbtmetabase/__init__.py @@ -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, diff --git a/dbtmetabase/metabase.py b/dbtmetabase/metabase.py index 0dade1fd..ae9c5a5c 100644 --- a/dbtmetabase/metabase.py +++ b/dbtmetabase/metabase.py @@ -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. @@ -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( diff --git a/requirements.txt b/requirements.txt index 485e1294..6a046994 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -PyYAML -requests -click -rich +PyYAML>=5.4.1 +requests>=2.26.0 +click>=8.0.0 +rich>=12.0.0