Skip to content

Passing the "LongAsMax": "Yes" option to the MS SQL Server ODBC driver? #620

@JustGitting

Description

@JustGitting

Is it possible to pass additional optional arguments to the ODBC driver in the profiles.yml config?

Please see the following link for the list of connection string keywords:

https://learn.microsoft.com/en-us/sql/connect/odbc/dsn-connection-string-attribute?view=sql-server-ver15

In particular I'd like to pass the "LongAsMax": "Yes" option to the ODBC driver.

It is not listed in the DBT connection options table (https://docs.getdbt.com/docs/core/connect-data-platform/mssql-setup#reference-of-all-connection-options)

Here is my example profiles.yml file:

my_project:
  target: dev
    outputs:
     dev:
        type: sqlserver
        driver: 'ODBC Driver 18 for SQL Server'
        server: myserver
        port: 1433
        database: mydb
        schema: dbt 
        user: user1
        windows_login: true
        trust_cert: true
        threads: 4

The reason I ask is because I suspect adding the LongAsMax option will fix the problem I'm having with dbt_artifacts.

[Bug]: Database Error ('22001', '[22001] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server] String or binary data would be truncated.
brooklyn-data/dbt_artifacts#521

Where I found the LongAsMax option from here:

https://docs.sqlalchemy.org/en/20/dialects/mssql.html#avoiding-sending-large-string-parameters-as-text-ntext
mkleehammer/pyodbc#835

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions