Query a tabular store

Note
Ensure that the API is available in your workspace environment; see Install the Data API for setup information.

Authentication

The Datasource client uses environment variables available in the workspace to automatically authenticate your identity.

To override this behavior, see Custom Authentication.

Usage

Assuming a data source named redshift-test is configured with valid credentials for the current user:

from domino.data_sources import DataSourceClient

# instantiate a client and fetch the datasource instance
redshift = DataSourceClient().get_datasource("redshift-test")

query = """
     SELECT
         firstname,
         lastname,
         age
     FROM
         employees
     LIMIT 1000
 """

 # res is a simple wrapper of the query result
 res = redshift.query(query)
 # to_pandas() loads the result into a pandas dataframe
 df = res.to_pandas()
 # check the first 10 rows
 df.head(10)