Hello, has anyone setup a dbt project with sql ser...
# ask-community
a
Hello, has anyone setup a dbt project with sql server? I was originally just going to use pyodbc to read a table in as an asset, once a day for freshness, but then started thinking dbt might be the better approach. Can I mix dbt assets with non dbt assets in the same code location?
t
Hi! Yes, you can mix dbt assets with non-dbt assets in the same code location. The dbt integration tutorial does a pretty good job at showing you how you can get the most out of using both tools together! https://docs.dagster.io/integrations/dbt
a
Hey Tim, I was looking at that. It all makes sense to me, just unsure of how to setup the project to connect to sql server
t
Got it, if it's the SQL Server portion, there are two parts two this: • For the dbt aspect, you'd use your standard profiles.yml to tell dbt how to connect to SQL Server. • Then for the Dagster part, to operate on them, you'd create a lightweight Resource around your pyodbc connection to help pass that connection around between your other Python assets that need to communicate with SQL Server
a
Ok, so that is a little confusing to me. Does dbt not handle the database connection for me?
From my understanding, the source defines the schema for which the profile uses. But, what handles getting the data?
t
We delegate how dbt connects to your database to dbt, since that can be finnicky if we try overriding it. Have you seen the dbt docs for how they connect to SQL Server? https://docs.getdbt.com/reference/warehouse-setups/mssql-setup
a
Ahh awesome. Was looking for something like that. Thanks!
t
awesome. cheers! feel free to send another question if you've got them!