cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Current_Database() function unexpected results when queried with PowerBI

DrK
New Contributor III

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.

1 REPLY 1

DrK
New Contributor III

Hya,

Responses.

  1. User has select and use on the schema, have tried execute the other day but it made no difference.
  2. 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.
  3. Tried this. Seems to work!
  4. See above.

Thanks for the response!

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group