<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic dbt writting into different schema in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/dbt-writting-into-different-schema/m-p/81777#M36411</link>
    <description>&lt;P&gt;I have a unity catalog and it goes like `catalogname.schemaname1`&amp;amp;&amp;nbsp;`catalogname.schemaname2`. and I am trying to write tables into&amp;nbsp;schemaname2 with dbt, the current setup in the dbt&amp;nbsp;profiles.yml is&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;prj_dbt_databricks:
  outputs:
    dev:
      catalog: catalogname
      host: adb-xxxx.azuredatabricks.net
      http_path: /sql/1.0/warehouses/xxx
      schema: schemaname1
      threads: 1
      token: "{{ env_var('DATABRICKS_TOKEN') }}"
      type: databricks
  target: dev&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so in the profiles.yml by default the schema is set to schemaname1.&amp;nbsp;&lt;BR /&gt;and in my dbt_project.yml the setting is below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;name: 'prj_dbt_databricks'
version: '1.0.0'

# This setting configures which "profile" dbt uses for this project.
profile: 'prj_dbt_databricks'

model-paths: ["models"]
analysis-paths: ["analyses"]
test-paths: ["tests"]
seed-paths: ["seeds"]
macro-paths: ["macros"]
snapshot-paths: ["snapshots"]

clean-targets:         # directories to be removed by `dbt clean`
  - "target"
  - "dbt_packages"

# Configuring models
# Full documentation: https://docs.getdbt.com/docs/configuring-models


models:
  prj_dbt_databricks:
    +persist_docs:
      relation: true
      columns: true
    +copy_grants: true
    schemaname1:
      +schema: schemaname1
      materialized: table
    schemaname2:
      +schema: schemaname2
      materialized: table

# Configuring seeds
seeds:
  prj_dbt_databricks:
    +persist_docs:
      relation: true     # Persist descriptions for seeds
      columns: true      # Persist descriptions for seed columns
    schemaname1:  # Applies to seeds under this directory
      +schema: 'schemaname1'
      +persist_docs:
        relation: true   # Persist descriptions for seeds
        columns: true    # Persist descriptions for seed columns&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and I put my SQL files in the corresponding folders for each schema under the models folder in DBT, however when I run the dbt models for schemaname2 it keeps writing into&amp;nbsp;schemaname1. I am not sure why it happens to Databrick catalog, it works fine for Snowflake&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Aug 2024 02:56:11 GMT</pubDate>
    <dc:creator>ruoyuqian</dc:creator>
    <dc:date>2024-08-05T02:56:11Z</dc:date>
    <item>
      <title>dbt writting into different schema</title>
      <link>https://community.databricks.com/t5/data-engineering/dbt-writting-into-different-schema/m-p/81777#M36411</link>
      <description>&lt;P&gt;I have a unity catalog and it goes like `catalogname.schemaname1`&amp;amp;&amp;nbsp;`catalogname.schemaname2`. and I am trying to write tables into&amp;nbsp;schemaname2 with dbt, the current setup in the dbt&amp;nbsp;profiles.yml is&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;prj_dbt_databricks:
  outputs:
    dev:
      catalog: catalogname
      host: adb-xxxx.azuredatabricks.net
      http_path: /sql/1.0/warehouses/xxx
      schema: schemaname1
      threads: 1
      token: "{{ env_var('DATABRICKS_TOKEN') }}"
      type: databricks
  target: dev&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so in the profiles.yml by default the schema is set to schemaname1.&amp;nbsp;&lt;BR /&gt;and in my dbt_project.yml the setting is below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;name: 'prj_dbt_databricks'
version: '1.0.0'

# This setting configures which "profile" dbt uses for this project.
profile: 'prj_dbt_databricks'

model-paths: ["models"]
analysis-paths: ["analyses"]
test-paths: ["tests"]
seed-paths: ["seeds"]
macro-paths: ["macros"]
snapshot-paths: ["snapshots"]

clean-targets:         # directories to be removed by `dbt clean`
  - "target"
  - "dbt_packages"

# Configuring models
# Full documentation: https://docs.getdbt.com/docs/configuring-models


models:
  prj_dbt_databricks:
    +persist_docs:
      relation: true
      columns: true
    +copy_grants: true
    schemaname1:
      +schema: schemaname1
      materialized: table
    schemaname2:
      +schema: schemaname2
      materialized: table

# Configuring seeds
seeds:
  prj_dbt_databricks:
    +persist_docs:
      relation: true     # Persist descriptions for seeds
      columns: true      # Persist descriptions for seed columns
    schemaname1:  # Applies to seeds under this directory
      +schema: 'schemaname1'
      +persist_docs:
        relation: true   # Persist descriptions for seeds
        columns: true    # Persist descriptions for seed columns&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and I put my SQL files in the corresponding folders for each schema under the models folder in DBT, however when I run the dbt models for schemaname2 it keeps writing into&amp;nbsp;schemaname1. I am not sure why it happens to Databrick catalog, it works fine for Snowflake&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2024 02:56:11 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dbt-writting-into-different-schema/m-p/81777#M36411</guid>
      <dc:creator>ruoyuqian</dc:creator>
      <dc:date>2024-08-05T02:56:11Z</dc:date>
    </item>
  </channel>
</rss>

