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

sql server compatibility #194

Open
jgilfillan opened this issue Sep 4, 2022 · 5 comments
Open

sql server compatibility #194

jgilfillan opened this issue Sep 4, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@jgilfillan
Copy link

Can someone provide some basic instructions on how to make this package sql server compatible? Is it just a case of adding a sqlserver function to each macro? TIA

@jaypeedevlin
Copy link
Contributor

Welcome. We're excited about the possibility of you making a contribution!

I would recommend waiting until #188 is merged before getting started as it changes some of the fundamentals of how the package works, but once that is done the key things you need to take care of:

  • Making sure the adapter you're supporting implements the type helpers used in the source models.
  • Adding overwrites for the custom type helpers if required
  • If required, creating adapter-specific version of the upload_* macros.
  • Adding SQLServer CI support

The last one is perhaps the trickiest, as it may involves setting up some infrastructure. We could potentially use some guidance from the sql server adapter maintainers as to how they've setup testing for their adapter.

@visch
Copy link

visch commented Oct 5, 2022

Welcome. We're excited about the possibility of you making a contribution!

I would recommend waiting until #188 is merged before getting started as it changes some of the fundamentals of how the package works, but once that is done the key things you need to take care of:

  • Making sure the adapter you're supporting implements the type helpers used in the source models.
  • Adding overwrites for the custom type helpers if required
  • If required, creating adapter-specific version of the upload_* macros.
  • Adding SQLServer CI support

The last one is perhaps the trickiest, as it may involves setting up some infrastructure. We could potentially use some guidance from the sql server adapter maintainers as to how they've setup testing for their adapter.

For the last point here's a SQL server spun up in CI https://github.com/AutoIDM/autoidm-target-mssql/blob/main/script.sh could tweak this for GH actions

@ataft
Copy link

ataft commented Oct 5, 2022

Looks like #188 is merged. I haven't verified, but imagine that the https://github.com/dbt-msft/tsql-utils package will help with the type helpers and upload_* macros. If using that the tsql-utils package, since many dbt utils have been moved to core, you need the following in dbt_project.yml:

dispatch:
  - macro_namespace: dbt
    search_order: ['tsql_utils', 'dbt']
  - macro_namespace: dbt_utils
    search_order: ['tsql_utils', 'dbt_utils']

@jgilfillan I don't have time to implement SQL Server compatibility right now, but can help. One thing to note is that SQL Server does not support nested CTES, but I haven't checked if anything in this project requires nested CTES.

@jgilfillan
Copy link
Author

name and schema are keywords in SQL Server that must be quoted in queries, either with double quotes (eg. "schema") or square brackets (eg [schema]). Any thoughts on the best way to implement this db-specific syntax within the model scripts?

@jgilfillan
Copy link
Author

Opened PR #248 which will close this issue.

@glsdown glsdown added the enhancement New feature or request label Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants