Dataset.query

Dataset.query(query_string) → Query

Execute a SQL query scoped to a particular dataset. Table names do not need to be fully qualified, since all tables are assumed to be within the dataset.

Parameters:

query_string : str The SQL query to execute. Must follow the Redivis SQL query syntax.

Returns:

Query

Examples

dataset = redivis.organization("Demo").dataset("CMS 2014 Medicare Data")

query = dataset.query("""
    SELECT 
        hospice_providers.name, 
        inpatient_charges.drg_definition
    -- The tables inpatient_chargers, hospice_providers are assumed to be 
    -- within the scoped dataset
    FROM inpatient_charges
    INNER JOIN hospice_providers 
        ON hospice_providers.provider_id = inpatient_charges.provider_id
""")

print(query.to_pandas_dataframe())

Last updated