microsoft / dbt-fabric

MIT License
79 stars 28 forks source link

Query across multiple workspaces #220

Open chinwobble opened 2 months ago

chinwobble commented 2 months ago

Hi there,

I want to know is it psosible to query across multiple workspaces?

My project has strict data privacy requirements. I want to two workspaces.

I want my dbt project to read from raw data workspace and write to the prod workspace. Is that possible?

M4Al commented 2 months ago

In the current fabric implementation you cannot do this via the SQL Endpoints that DBT uses.

You could use the 'shortcut' feature of Fabric if your data lives in a Lakehouse maybe?

chinwobble commented 2 months ago

@M4Al thanks for your response. The 'shortcut' feature works with Fabric lakehouse. Does that mean I can achieve this with the dbt-fabricpark dbt adapter instead? https://github.com/microsoft/dbt-fabricspark

ThomsenS commented 2 months ago

You can access shortcuts in a lakehouse from your warehouse as long as they are in the same workspace using 3 part naming. In your query include the lakehouse name, e.g. select * from lakehouse_name.schema_name.shortcut_name.

We define them as sources in our projects. The source macro will then automatically create queries using 3 part naming.

version: 2

sources:
- name: source_name
  database: lakehouse_name
  schema: schema_name
  tables:
    - name: table_name/shortcut_name
TheBishop-98 commented 2 months ago

If this capability isn't on the roadmap, it should be. My company has used the 'shortcut' method, but we shouldn't have to. We should be able to read across WS and still write to the same DW, if the user has access to those workspaces. I imagine we would have to define a fabric specific workspace property to further define and link to read those LH/DW.

prdpsvs commented 2 months ago

Shortcut capability is in the roadmap to the DW as well. Currently, the only way to access data from other workspace is to create a shortcut from LH or duplicate data.

With DW shortcut capability, the tables from other DW's in the same/across workspaces can be accessed in the same DW, similar to LH. Once this feature is enabled by the platform, the adapter will support shortcut sources from different workspaces.

prdpsvs commented 2 months ago

@M4Al thanks for your response. The 'shortcut' feature works with Fabric lakehouse. Does that mean I can achieve this with the dbt-fabricpark dbt adapter instead? https://github.com/microsoft/dbt-fabricspark

Yes, dbt-fabricspark creates shortcuts for you to access data from other LHs in the same or different workspaces and then access data. This is not currently possible with DW though.