Current_Database() function unexpected results when queried with PowerBI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2023 03:57 AM
Hi,
I`m creating some views to be queried by PowerBI. In our delta tables we have a column called database name which contains the source systems database name. What I`m doing is using this to filter data WHERE databaseName = current_database(). Now I`ve had to replace the `s that come through this value and all works ok when queried within a worksheet, i.e. if I change database\schema context, my rows get filtered. However, if I query the same view from PowerBI, I got no data at all. I`ve tested the view using a hardcoded database name i.e. WHERE databaseName = 'the database name' and that works fine. The ony thing I could think it could be is priviledges, as the PAT token created for access by PowerBI only has SELECT priviledges on the database, wondering if it can`t use the Current_Database() function or similar.
Drk.
- Labels:
-
Delta Tables
-
Powerbi Databricks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2023 12:52 AM
Hya,
Responses.
- User has select and use on the schema, have tried execute the other day but it made no difference.
- We can`t do this as the database filtered by the view has to be controlled by us as it`s part of a multi-tenanted setup.
- Tried this. Seems to work!
- See above.
Thanks for the response!

