Visualizations failing to show
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 10:29 AM
I have a SQL query that generates a table. I created a visualization from that table with the UI. I then have a widget that updates a value used in the query and re-runs the SQL, but then the visualization shows nothing, that there is "1 row," but if I select the table it shows all the rows and if I click "edit visualization" it shows the correct visualization. What's wrong with visualizations?
- Labels:
-
Spark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 02:04 PM
To be clear: the data is correct in the table. It's also correctly displayed if I click "edit visualization." It's only the re-run visualization in the notebook / dashboard that is empty when I update a widget to use a different value.
The code looks something like:
location = dbutils.widgets.get("locations")
ids = spark.read.table("production.gold.devices").select("id").where(f"location = '{location}'").distinct().toPandas()['id']
dbutils.widgets.dropdown('device_ids', values=ids, default='', label='Device IDs')
# ... Another cell
device_id = dbutils.widgets.get('device_ids')
spark.read.table("production.gold.data").where(f"location = '{location}' AND device_id = '{device_id}' AND create_time > now() - INTERVAL 30 DAYS")
# PowerBI Linear graph visualization