In App Workspaces, you have access to a schema browser for Data Sources linked to your app, allowing you to browse the contents of a data source.
You can also preview the data from data source tables or files and copy auto-generated code snippets to access the data from within a notebook or Python script.
Databricks, Snowflake, AWS S3, AWS Redshift, and Google BigQuery data sources linked to your app are available from the Data Sources menu in the workspace:
<img>
Select it to see a full list of data sources linked to the project.
<img>
If you haven’t linked any data sources, you can link one by selecting the Link Source button. See the Data Sources page for more details.
<img>
Otherwise, select a data source to connect to it. Once it loads, you’ll see the data structure of the source.
Note: If the data source has views, those are not displayed in the schema browser.
If you are connecting to a Databricks, Snowflake, AWS Redshift, or Google BigQuery data source, select a table to see a list of its properties and their data types. Select a property name to copy it to the clipboard.
<img>
Data types displayed in the schema browser are displayed based on the types in the original data source for Databricks, Snowflake, AWS Redshift, and Google BigQuery.
For AWS S3, when the schema browser loads the data source, you’ll see the file structure of the bucket. You can select a .csv
file to view the properties within it. As the files loaded are .csv
files, the type for each property will be “String”.
From the table info view, select the Open Data Preview button to see up to the first 1000 rows in the table.
<img>
You can also access the data preview from the menu options beside a table:
<img>
Available in workspaces version 1.4.0 and later
For SQL-based data sources available in the schema browser, you can generate a query in the active notebook by selecting Query in Notebook from the menu options beside a table.
<img>.
See the Running SQL Queries in Notebooks for a complete guide to running SQL queries in notebooks in a workspace.
From the Data Preview page, select Copy Code to get code to run in your notebook to get the first 100 records from that table.
<img>
The copied code snippet uses dash_enterprise_libraries
data_sources
and will look similar to
from dash_enterprise_libraries import data_sources as ds
df = ds.read_sql("SELECT * FROM my_db.my_table LIMIT 100", "my_databricks")
You can also access a code snippet for any table without first opening the data preview by using the menu options beside a table name:
<img>
To reload the data source in the schema browser, select Refresh Data from the menu options beside the data source name:
<img>
The schema browser doesn’t support Redshift data sources that use AWS auth.