diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4b45f70d1..33ab53c13 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -44,7 +44,7 @@ repos: - id: check-readthedocs - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.1 + rev: v0.8.2 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix, --show-fixes] diff --git a/singer_sdk/connectors/sql.py b/singer_sdk/connectors/sql.py index 3302a249f..00c83b884 100644 --- a/singer_sdk/connectors/sql.py +++ b/singer_sdk/connectors/sql.py @@ -1470,19 +1470,19 @@ def _get_type_sort_key( ) -> tuple[int, int]: # return rank, with higher numbers ranking first - _len = int(getattr(sql_type, "length", 0) or 0) - - _pytype = t.cast("type", sql_type.python_type) - if issubclass(_pytype, (str, bytes)): - return 900, _len - if issubclass(_pytype, datetime): - return 600, _len - if issubclass(_pytype, float): - return 400, _len - if issubclass(_pytype, int): - return 300, _len - - return 0, _len + len_ = int(getattr(sql_type, "length", 0) or 0) + + pytype = t.cast("type", sql_type.python_type) + if issubclass(pytype, (str, bytes)): + return 900, len_ + if issubclass(pytype, datetime): + return 600, len_ + if issubclass(pytype, float): + return 400, len_ + if issubclass(pytype, int): + return 300, len_ + + return 0, len_ return sorted(sql_types, key=_get_type_sort_key, reverse=True) diff --git a/singer_sdk/sinks/core.py b/singer_sdk/sinks/core.py index 7d9d24a3c..dcac2bee4 100644 --- a/singer_sdk/sinks/core.py +++ b/singer_sdk/sinks/core.py @@ -456,7 +456,7 @@ def _add_sdc_metadata_to_record( or datetime.datetime.now(tz=datetime.timezone.utc) ).isoformat() record["_sdc_deleted_at"] = record.get("_sdc_deleted_at") - record["_sdc_sequence"] = int(round(time.time() * 1000)) + record["_sdc_sequence"] = round(time.time() * 1000) record["_sdc_table_version"] = message.get("version") record["_sdc_sync_started_at"] = self.sync_started_at diff --git a/tests/samples/conftest.py b/tests/samples/conftest.py index d1bd024d3..1202dc688 100644 --- a/tests/samples/conftest.py +++ b/tests/samples/conftest.py @@ -19,7 +19,7 @@ def csv_config(outdir: str) -> dict: @pytest.fixture -def _sqlite_sample_db(sqlite_connector): +def sqlite_sample_db(sqlite_connector: SQLiteConnector): """Return a path to a newly constructed sample DB.""" with sqlite_connector._connect() as conn, conn.begin(): for t in range(3): @@ -72,12 +72,12 @@ def sqlite_sample_db_catalog(sqlite_sample_db_config) -> Catalog: @pytest.fixture def sqlite_sample_tap( - _sqlite_sample_db, + sqlite_sample_db, sqlite_sample_db_config, sqlite_sample_db_state, sqlite_sample_db_catalog, ) -> SQLiteTap: - _ = _sqlite_sample_db + _ = sqlite_sample_db return SQLiteTap( config=sqlite_sample_db_config, catalog=sqlite_sample_db_catalog.to_dict(),