Power BI with DuckDB and MotherDuck
Power BI is an interactive data visualization product developed by Microsoft. MotherDuck has built an open-source DuckDB Power Query Connector that you can use to connecto Power BI to DuckDB and MotherDuck.
Installing
-
Download the latest DuckDB ODBC driver from the DuckDB Power Query Connector GitHub Releases for Windows:
-
Extract the
.zip
archive into a permanent location, such asC:\Program Files\duckdb_odbc
, and install the latest DuckDB driver by runningodbc_install.exe
. -
Check that the correct version was installed. To do this, open the Registry Editor by running
regedit
in the command prompt orRun
dialog. Browse to theHKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\DuckDB Driver
entry and check that the Driver field contains the version you installed. If not, delete theDuckDB Driver
registry key and rerun the installer. -
Open Power BI, go to File -> Options and settings -> Options -> Security -> Data Extensions. Enable "Allow any extensions to load without validation or warning".
-
Download the latest version of the DuckDB Power Query extension:
-
Create this folder if it does not yet exist:
[Documents]\Power BI Desktop\Custom Connectors
. -
Move or copy the
duckdb-power-query-connector.mez
file into[Documents]\Power BI Desktop\Custom Connectors
. Note that if this location does not work, you may need to place this in your OneDrive Documents folder.
How to use with Power BI
- Click on Get Data -> More...
- Search for
DuckDB
and click "Connect" - Enter your database location. This can be a local file path (e.g.
~\my_database.db
) or a MotherDuck database location (e.g.md:my_database
). (Optional) enter your MotherDuck token. If you want to access the database inread_only
mode, you can set it totrue
. Click "OK". - Click "Connect".
- Select the table(s) you want to import. Click "Load".
- You can now query your data and create visualizations!
Use custom data connectors with an on-premises data gateway
You can use custom data connectors with an on-premises data gateway to connect to data sources that are not supported by default. To do this, you need to install the on-premises data gateway and configure it to use the custom data connector. For more information, see Use custom data connectors with an on-premises data gateway in Power BI.
It should be noted that there are some limitations with using a custom connector with an on-premise data gateway:
-
Make sure the folder you create is accessible to the background gateway service. Typically, folders under your users' Windows folders or system folders aren't accessible. The on-premises data gateway app shows a message if the folder isn't accessible. This limitation doesn't apply to the on-premises data gateway (personal mode).
-
If your custom connector is on a network drive, include the fully qualified path in the on-premises data gateway app.
-
You can only use one custom connector data source when working in DirectQuery mode. Multiple custom connector data sources don't work with DirectQuery.