Skip to content

Commit

Permalink
Ensure activate_version is tested in SQL targets
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Mar 6, 2023
1 parent d3f377b commit d718c42
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 4 additions & 2 deletions singer_sdk/sinks/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,10 @@ def activate_version(self, new_version: int) -> None:
if self.config.get("hard_delete", True):
with self.connector._connect() as conn, conn.begin():
conn.execute(
f"DELETE FROM {self.full_table_name} "
f"WHERE {self.version_column_name} <= {new_version}"
sqlalchemy.text(
f"DELETE FROM {self.full_table_name} "
f"WHERE {self.version_column_name} <= {new_version}"
)
)
return

Expand Down
5 changes: 1 addition & 4 deletions tests/samples/test_target_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ def sqlite_sample_target(sqlite_target_test_config):
@pytest.fixture
def sqlite_sample_target_soft_delete(sqlite_target_test_config):
"""Get a sample target object with hard_delete disabled."""
conf = sqlite_target_test_config
conf["hard_delete"] = False

return SQLiteTarget(conf)
return SQLiteTarget({**sqlite_target_test_config, "hard_delete": False})


@pytest.fixture
Expand Down

0 comments on commit d718c42

Please sign in to comment.