Skip to content

Commit a95bc42

Browse files
fix: Address Singer SDK import deprecation warnings
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
1 parent 1dffff2 commit a95bc42

File tree

9 files changed

+310
-280
lines changed

9 files changed

+310
-280
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
ci:
22
autofix_prs: true
3+
autofix_commit_msg: "style: pre-commit fixes"
34
autoupdate_schedule: monthly
45
autoupdate_commit_msg: 'chore: pre-commit autoupdate'
56

@@ -21,10 +22,10 @@ repos:
2122
- id: check-github-workflows
2223

2324
- repo: https://github.com/astral-sh/ruff-pre-commit
24-
rev: v0.14.14
25+
rev: v0.15.0
2526
hooks:
2627
- id: ruff-check
27-
args: [--fix, --exit-non-zero-on-fix]
28+
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
2829
- id: ruff-format
2930

3031
- repo: https://github.com/pre-commit/mirrors-mypy
@@ -35,6 +36,11 @@ repos:
3536
- types-requests
3637

3738
- repo: https://github.com/astral-sh/uv-pre-commit
38-
rev: 0.9.28
39+
rev: 0.10.0
3940
hooks:
4041
- id: uv-lock
42+
43+
- repo: https://github.com/crate-ci/typos
44+
rev: v1.43.4
45+
hooks:
46+
- id: typos

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Built with the [Meltano Singer SDK](https://sdk.meltano.com).
3434
| validate_records | False | 1 | Whether to validate the schema of the incoming streams. |
3535
| stream_maps | False | None | Config object for stream maps capability. For more information check out [Stream Maps](https://sdk.meltano.com/en/latest/stream_maps.html). |
3636
| stream_map_config | False | None | User-defined config values to be used within map expressions. |
37-
| faker_config | False | None | Config for the [`Faker`](https://faker.readthedocs.io/en/master/) instance variable `fake` used within map expressions. Only applicable if the plugin specifies `faker` as an addtional dependency (through the `singer-sdk` `faker` extra or directly). |
37+
| faker_config | False | None | Config for the [`Faker`](https://faker.readthedocs.io/en/master/) instance variable `fake` used within map expressions. Only applicable if the plugin specifies `faker` as an additional dependency (through the `singer-sdk` `faker` extra or directly). |
3838
| faker_config.seed | False | None | Value to seed the Faker generator for deterministic output: https://faker.readthedocs.io/en/master/#seeding-the-generator |
3939
| faker_config.locale | False | None | One or more LCID locale strings to produce localized output for: https://faker.readthedocs.io/en/master/#localization |
4040
| flattening_enabled | False | None | 'True' to enable schema flattening and automatically expand nested properties. |

pyproject.toml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ target-snowflake = "target_snowflake.target:TargetSnowflake.cli"
4242
[dependency-groups]
4343
dev = [
4444
"coverage>=7.2.7",
45-
"pytest>=8",
45+
"pytest>=9",
4646
"pytest-xdist>=3.3.1",
4747
"singer-sdk[testing]",
4848
]
@@ -83,5 +83,12 @@ required-imports = ["from __future__ import annotations"]
8383
[tool.ruff.lint.pydocstyle]
8484
convention = "google"
8585

86-
[tool.pytest.ini_options]
87-
addopts = '--durations=10'
86+
[tool.pytest]
87+
addopts = [
88+
"--durations=10",
89+
]
90+
filterwarnings = [
91+
"error",
92+
"once:`SQLConnector.connection` is deprecated:singer_sdk.helpers._compat.SingerSDKDeprecationWarning",
93+
]
94+
minversion = "9"

target_snowflake/connector.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
import sqlalchemy.sql.type_api
1515
from cryptography.hazmat.backends import default_backend
1616
from cryptography.hazmat.primitives import serialization
17-
from singer_sdk.connectors import SQLConnector
18-
from singer_sdk.connectors.sql import FullyQualifiedName, JSONSchemaToSQL
1917
from singer_sdk.exceptions import ConfigValidationError
18+
from singer_sdk.sql.connector import FullyQualifiedName, JSONSchemaToSQL, SQLConnector
2019
from snowflake.sqlalchemy import URL
2120
from snowflake.sqlalchemy.base import SnowflakeIdentifierPreparer
2221
from snowflake.sqlalchemy.snowdialect import SnowflakeDialect

target_snowflake/sinks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
from urllib.parse import urlparse
88
from uuid import uuid4
99

10-
from singer_sdk.batch import JSONLinesBatcher
10+
from singer_sdk.contrib.batch_encoder_jsonl import JSONLinesBatcher
1111
from singer_sdk.helpers._batch import (
1212
BaseBatchFileEncoding,
1313
BatchConfig,
1414
BatchFileFormat,
1515
)
1616
from singer_sdk.helpers._typing import conform_record_data_types
17-
from singer_sdk.sinks import SQLSink
17+
from singer_sdk.sql.sink import SQLSink
1818
from snowflake.sqlalchemy.base import SnowflakeIdentifierPreparer
1919
from snowflake.sqlalchemy.snowdialect import SnowflakeDialect
2020

target_snowflake/target.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import click
88
from singer_sdk import typing as th
9-
from singer_sdk.target_base import SQLTarget
9+
from singer_sdk.sql.target import SQLTarget
1010

1111
from target_snowflake.connector import DEFAULT_TIMESTAMP_TYPE, SnowflakeTimestampType
1212
from target_snowflake.initializer import initializer
@@ -124,7 +124,7 @@ class TargetSnowflake(SQLTarget):
124124
default_sink_class = SnowflakeSink
125125

126126
@classmethod
127-
def cb_inititalize(
127+
def cb_initialize(
128128
cls: type[TargetSnowflake],
129129
ctx: click.Context,
130130
param: click.Option, # noqa: ARG003
@@ -148,7 +148,7 @@ def get_singer_command(cls: type[TargetSnowflake]) -> click.Command:
148148
["--initialize"],
149149
is_flag=True,
150150
help="Interactive Snowflake account initialization.",
151-
callback=cls.cb_inititalize,
151+
callback=cls.cb_initialize,
152152
expose_value=False,
153153
),
154154
],

tests/batch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import typing as t
66
from pathlib import Path
77

8-
from singer_sdk.testing.suites import TestSuite
8+
from singer_sdk.testing.suites import SingerTestSuite
99
from singer_sdk.testing.target_tests import (
1010
TargetNoPrimaryKeys,
1111
TargetSpecialCharsInAttributes,
@@ -174,7 +174,7 @@ class SnowflakeTargetBatchSpecialCharsInAttributes(
174174
name = "batch_special_chars_in_attributes"
175175

176176

177-
batch_target_tests = TestSuite(
177+
batch_target_tests = SingerTestSuite(
178178
kind="target",
179179
tests=[
180180
# BATCH

tests/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import pytest
66
import snowflake.sqlalchemy.custom_types as sct
7-
from singer_sdk.testing.suites import TestSuite
7+
from singer_sdk.testing.suites import SingerTestSuite
88
from singer_sdk.testing.target_tests import (
99
TargetArrayData,
1010
TargetCamelcaseComplexSchema,
@@ -567,7 +567,7 @@ def singer_filepath(self) -> Path:
567567
return current_dir / "target_test_streams" / f"{self.name}.singer"
568568

569569

570-
target_tests = TestSuite(
570+
target_tests = SingerTestSuite(
571571
kind="target",
572572
tests=[
573573
# Core

0 commit comments

Comments
 (0)