Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 03:10 AM
I see, I missed that.
Buttons should work according to the docs.
The example has output however, maybe that is the issue:
import ipywidgets as widgets
# Create button widget. Clicking this button loads a sampled dataframe from UC table.
button = widgets.Button(description="Load dataframe sample")
# Output widget to display the loaded dataframe
output = widgets.Output()
def load_sample_df(table_name):
return spark.sql(f"SELECT * FROM {table_name} LIMIT 1000")
def on_button_clicked(_):
with output:
output.clear_output()
df = load_sample_df('<catalog>.<schema>.<table>')
print(df.toPandas())
# Register the button's callback function to query UC and display results to the output widget
button.on_click(on_button_clicked)
display(button, output)