Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
hholgersen committed Apr 19, 2023
1 parent a543789 commit a506521
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
14 changes: 6 additions & 8 deletions target_mssql/sinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,25 @@

import json
import re
from typing import Any, Dict, Iterable, List, Optional
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional

import sqlalchemy
from singer_sdk.helpers._conformers import replace_leading_digit
from singer_sdk.sinks import SQLSink
from singer_sdk.sinks import SQLConnector, SQLSink
from sqlalchemy import Column
from typing import TYPE_CHECKING, Any, Iterable

from target_mssql.connector import mssqlConnector
from singer_sdk.sinks import SQLConnector

if TYPE_CHECKING:
from singer_sdk.plugin_base import PluginBase
from sqlalchemy.sql import Executable

from singer_sdk.plugin_base import PluginBase

class mssqlSink(SQLSink):
"""mssql target sink class."""

connector_class = mssqlConnector


def __init__(
self,
target: PluginBase,
Expand All @@ -34,8 +32,8 @@ def __init__(
connector: SQLConnector | None = None,
) -> None:
super().__init__(target, stream_name, schema, key_properties)
if self._config.get('table_prefix'):
self.stream_name = self._config.get('table_prefix') + stream_name
if self._config.get("table_prefix"):
self.stream_name = self._config.get("table_prefix") + stream_name

# Copied purely to help with type hints
@property
Expand Down
6 changes: 2 additions & 4 deletions target_mssql/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ class Targetmssql(SQLTarget):
description="Default target schema to write to",
),
th.Property(
"table_prefix",
th.StringType,
description="Prefix to add to table name"
)
"table_prefix", th.StringType, description="Prefix to add to table name"
),
).to_dict()

default_sink_class = mssqlSink
Expand Down
4 changes: 2 additions & 2 deletions target_mssql/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def mssql_config():
"host": "localhost",
"port": "1433",
"database": "master",
"table_prefix": "prfx_"
"table_prefix": "prfx_",
}


Expand All @@ -38,7 +38,7 @@ def mssql_dualconfig():
"password": "wrong_password",
"host": "localhost",
"port": "1433",
"database": "master"
"database": "master",
}


Expand Down

0 comments on commit a506521

Please sign in to comment.