texas-gov/key-economic-indicators-karz-jr5v
Loading...

Query the Data Delivery Network

Query the DDN

The easiest way to query any data on Splitgraph is via the "Data Delivery Network" (DDN). The DDN is a single endpoint that speaks the PostgreSQL wire protocol. Any Splitgraph user can connect to it at data.splitgraph.com:5432 and query any version of over 40,000 datasets that are hosted or proxied by Splitgraph.

For example, you can query the key_economic_indicators table in this repository, by referencing it like:

"texas-gov/key-economic-indicators-karz-jr5v:latest"."key_economic_indicators"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "cpi_tx", -- Measures the average change over a reference base period of time, currently set between 1982-1984, of the prices paid by urban consumers for a market basket of goods and services in TX. Source: U.S. Bureau of Labor Statistics
    "non_residential_building_construction", -- The value of construction starts for non-residential construction in the state of TX over a one month period of time. Source: McGraw-Hill
    "cpi_us", -- Measures the average change over a reference base period of time, currently set between 1982-1984, of the prices paid by urban consumers for a market basket of goods and services in U.S. Source: U.S. Bureau of Labor Statistics
    "multi_family_building_permits_tx", -- Represents data on new privately-owned residential construction. The data only shows information on multi-family building permits issued for new construction. The number of permits issued does not necessarily mean that the same number of residential structures will be built.  Source: The Real Estate Center at Texas A&M University
    "consumer_confidence_index_wsc", -- A barometer of the health of the West South Central economy from the perspective of consumers. This index looks at consumers' perception of current business and employment conditions. Source: The Conference Board
    "unemployment_us", -- Represents a percentage of the civilian labor force that is unemployed in the U.S. Source: U.S. Bureau of Labor Statistics
    "gross_value_crude_oil_production", -- In millions
    "nonfarm_employment_ca_detail", -- Represents the number of persons who work and are on the payroll of nonagricultural establishments in California. Source: U.S. Bureau of Labor Statistics
    "existing_single_family_home_sales_tx", -- Total Single Family Home Sales in a one month period in the state of TX. Source: The Real Estate Center at Texas A&M University
    "motor_fuel_taxed_diesel", -- In millions of gallons
    "motor_fuel_taxed_gasoline", -- In millions of gallons
    "gross_value_natural_gas_production", -- In millions
    "nonfarm_employment_ny_detail", -- Represents the number of persons who work and are on the payroll of nonagricultural establishments in New York. Source: U.S. Bureau of Labor Statistics
    "nonfarm_employment_fl_detail", -- Represents the number of persons who work and are on the payroll of nonagricultural establishments in Florida. Source: U.S. Bureau of Labor Statistics
    "nonfarm_employment_il_detail", -- Represents the number of persons who work and are on the payroll of nonagricultural establishments in Illinois. Source: U.S. Bureau of Labor Statistics
    "retail_diesel_price_tx", -- Average price paid by TX consumers for diesel fuel at the pump.  Source: Energy Information Administration
    "retail_gasoline_price_tx", -- Average price of gasoline at the pump paid by TX consumers. Source: Energy Information Administration
    "unemployment_tx", -- Represents a percentage of the civilian labor force that is unemployed in TX. Source: Texas Workforce Commission
    "nonfarm_employment_us", -- Represents the number of persons who work and are on the payroll of nonagricultural establishments in the U.S. Source: U.S. Bureau of Labor Statistics
    "nonfarm_employment_tx", -- Represents the number of persons who work and are on the payroll of nonagricultural establishments in TX.  Source: Texas Workforce Commission
    "cpi_us_ex_food_and_energy", -- Measures the average change over a reference base period of time, currently set between 1982-1984, of the prices paid by urban consumers for a market basket of goods and services in U.S., excluding food and energy. Source: U.S. Bureau of Labor Statistics
    "consumer_confidence_index_us", -- A barometer of the health of the U.S. economy from the perspective of consumers. This index looks at consumers' perception of current business and employment conditions (including their expectations six months into the future). Source: The Conference Board
    "consumer_confidence_index_texas", -- A barometer of the health of the TX economy from the perspective of consumers. This index looks at consumers' perception of current business and employment conditions. Source: The Conference Board
    "year", -- The year the data represents.
    "month", -- The month the data represents.
    "total_sales_tax_collections_tx", -- Total sales tax collected in Texas over a one month period. Source: Texas Comptroller of Public Accounts
    "existing_single_family_home_price_tx", -- Median Single Family Home Price over a one month period in the state of TX. Source: The Real Estate Center at Texas A&M University
    "single_family_building_permits_tx", -- Represents data on new privately-owned residential construction. The data only shows information on single-family building permits issued for new construction. The number of permits issued does not necessarily mean that the same number of residential structures will be built.  Source: The Real Estate Center at Texas A&M University
    "nonfarm_employment_tx_detail", -- Represents the number of persons who work and are on the payroll of nonagricultural establishments in TX.  Source: U.S. Bureau of Labor Statistics
    "tax_collections_retail_tx", -- Total sales tax collected in Texas from retailers over a one month period. Source: Texas Comptroller of Public Accounts
    "pce_deflator"
FROM
    "texas-gov/key-economic-indicators-karz-jr5v:latest"."key_economic_indicators"
LIMIT 100;

Connecting to the DDN is easy. All you need is an existing SQL client that can connect to Postgres. As long as you have a SQL client ready, you'll be able to query texas-gov/key-economic-indicators-karz-jr5v with SQL in under 60 seconds.

Query Your Local Engine

Install Splitgraph Locally
bash -c "$(curl -sL https://github.com/splitgraph/splitgraph/releases/latest/download/install.sh)"
 

Read the installation docs.

Splitgraph Cloud is built around Splitgraph Core (GitHub), which includes a local Splitgraph Engine packaged as a Docker image. Splitgraph Cloud is basically a scaled-up version of that local Engine. When you query the Data Delivery Network or the REST API, we mount the relevant datasets in an Engine on our servers and execute your query on it.

It's possible to run this engine locally. You'll need a Mac, Windows or Linux system to install sgr, and a Docker installation to run the engine. You don't need to know how to actually use Docker; sgrcan manage the image, container and volume for you.

There are a few ways to ingest data into the local engine.

For external repositories, the Splitgraph Engine can "mount" upstream data sources by using sgr mount. This feature is built around Postgres Foreign Data Wrappers (FDW). You can write custom "mount handlers" for any upstream data source. For an example, we blogged about making a custom mount handler for HackerNews stories.

For hosted datasets (like this repository), where the author has pushed Splitgraph Images to the repository, you can "clone" and/or "checkout" the data using sgr cloneand sgr checkout.

Cloning Data

Because texas-gov/key-economic-indicators-karz-jr5v:latest is a Splitgraph Image, you can clone the data from Spltgraph Cloud to your local engine, where you can query it like any other Postgres database, using any of your existing tools.

First, install Splitgraph if you haven't already.

Clone the metadata with sgr clone

This will be quick, and does not download the actual data.

sgr clone texas-gov/key-economic-indicators-karz-jr5v

Checkout the data

Once you've cloned the data, you need to "checkout" the tag that you want. For example, to checkout the latest tag:

sgr checkout texas-gov/key-economic-indicators-karz-jr5v:latest

This will download all the objects for the latest tag of texas-gov/key-economic-indicators-karz-jr5v and load them into the Splitgraph Engine. Depending on your connection speed and the size of the data, you will need to wait for the checkout to complete. Once it's complete, you will be able to query the data like you would any other Postgres database.

Alternatively, use "layered checkout" to avoid downloading all the data

The data in texas-gov/key-economic-indicators-karz-jr5v:latest is 0 bytes. If this is too big to download all at once, or perhaps you only need to query a subset of it, you can use a layered checkout.:

sgr checkout --layered texas-gov/key-economic-indicators-karz-jr5v:latest

This will not download all the data, but it will create a schema comprised of foreign tables, that you can query as you would any other data. Splitgraph will lazily download the required objects as you query the data. In some cases, this might be faster or more efficient than a regular checkout.

Read the layered querying documentation to learn about when and why you might want to use layered queries.

Query the data with your existing tools

Once you've loaded the data into your local Splitgraph Engine, you can query it with any of your existing tools. As far as they're concerned, texas-gov/key-economic-indicators-karz-jr5v is just another Postgres schema.

Related Documentation:

Loading...