Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: connect_args for pymssql #20

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tap_mssql/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,27 @@ def create_engine(self) -> Engine:
f"{eng_prefix}echo": "False"
}

if self.config.get("azure_synapse_dw") and self.config.get('driver_type') == "pymssql":
CONN_PROPERTIES = (
"SET ARITHABORT ON;"
"SET CONCAT_NULL_YIELDS_NULL ON;"
"SET ANSI_NULLS ON;"
"SET ANSI_NULL_DFLT_ON ON;"
"SET ANSI_PADDING ON;"
"SET ANSI_WARNINGS ON;"
"SET ANSI_NULL_DFLT_ON ON;"
"SET QUOTED_IDENTIFIER ON;"
"SET TEXTSIZE 2147483647;"
)
connect_args = {}
connect_args['conn_properties']=CONN_PROPERTIES
eng_config.update({f"{eng_prefix}connect_args":connect_args})

if self.config.get('sqlalchemy_eng_params'):
for key, value in self.config['sqlalchemy_eng_params'].items():
eng_config.update({f"{eng_prefix}{key}": value})

self.logger.info(eng_config)
return sqlalchemy.engine_from_config(eng_config, prefix=eng_prefix)

def to_jsonschema_type(
Expand Down
6 changes: 6 additions & 0 deletions tap_mssql/tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ class Tapmssql(SQLTap):
th.StringType,
description="The Default database for this connection"
),
th.Property(
"azure_synapse_dw",
th.BooleanType,
default=False,
description="Test to see if connection_options works for pymssql"
),
th.Property(
"sqlalchemy_eng_params",
th.ObjectType(
Expand Down