ftb-ca-gov/c10a-and-c10b-tax-liability-by-industry-c-and-s-sgsk-qj69
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 c10a_and_c10b_tax_liability_by_industry_c_and_s table in this repository, by referencing it like:

"ftb-ca-gov/c10a-and-c10b-tax-liability-by-industry-c-and-s-sgsk-qj69:latest"."c10a_and_c10b_tax_liability_by_industry_c_and_s"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "total_returns_for_all_industry_categories_with_tax_liability", -- Number of total returns for all industry categories with tax liability.
    "professional_scientific_and_technical_services_total_tax", -- Professional scientific and technical services total tax amount.
    "professional_scientific_and_technical_services_net_income_less_", -- Total professional scientific and technical services net income less net loss amount.  
    "returns_reporting_tax_liability_in_professional_scientific_and_", -- Number of returns reporting tax liability in professional, scientific, and technical services.
    "total_services_total_tax", -- Total services group total tax amount.
    "total_services_net_income_less_net_loss", -- Total of services group net income less net loss amount.  
    "total_returns_reporting_tax_liability_in_services", -- otal number of returns reporting tax liability in the services group (professional, scientific, and technical services, administrative services, accommodation and food services, arts, entertainment, and recreation services, health services, and other services).
    "nondurable_goods_manufacturing_total_tax", -- Nondurable goods manufacturing total tax amount.
    "nondurable_goods_manufacturing_net_income_less_net_loss", -- Total nondurable goods manufacturing net income less net loss amount. 
    "returns_reporting_tax_liability_in_nondurable_goods_manufacturi", -- Number of returns reporting tax liability in nondurable goods manufacturing.
    "total_durable_goods_manufacturing_total_tax", -- Durable goods manufacturing total tax amount.
    "total_durable_goods_manufacturing_net_income_less_net_loss", -- Total durable goods manufacturing net income less net loss amount.  
    "total_returns_reporting_tax_liability_in_durable_goods_manufact", -- Number of returns reporting tax liability in durable goods manufacturing.
    "manufacturing_total_tax", -- Manufacturing total tax amount.
    "manufacturing_net_income_less_net_loss", -- Total manufacturing (durable and nondurable goods) net income less net loss amount.  
    "returns_reporting_tax_liability_in_manufacturing", -- Total number of returns reporting tax liability in manufacturing (durable and nondurable goods).
    "construction_total_tax", -- Construction total tax amount.
    "construction_net_income_less_net_loss", -- Total construction net income less net loss amount.  
    "returns_reporting_tax_liability_in_construction", -- Number of returns reporting tax liability in construction.
    "mining_total_tax", -- Mining total tax amount.
    "mining_net_income_less_net_loss", -- Total mining net Income less net loss amount.  
    "returns_reporting_tax_liability_in_mining", -- Number of returns reporting tax liability In mining.
    "agriculture_forestry_and_fishing_total_tax", -- Agriculture, forestry, and fishing total tax amount.
    "agriculture_forestry_and_fishing_net_income_less_net_loss", -- Total agriculture, forestry, and fishing net income less net loss amount. 
    "returns_reporting_tax_liability_in_holding_companies", -- Number of returns reporting tax liability in holding companies.
    "holding_companies_net_income_less_net_loss", -- Holding companies net income less net loss amount. 
    "holding_companies_total_tax", -- Holding companies total tax amount.
    "returns_reporting_tax_liability_in_real_estate", -- Number of returns reporting tax liability in real estate.
    "real_estate_net_income_less_net_loss", -- Real estate net income less net loss amount.
    "real_estate_net_income_total_tax", -- Real estate net income total tax amount.
    "returns_reporting_tax_liability_in_transportation_warehousing_a", -- Number of returns reporting tax liability in transportation warehousing and utilities.
    "transportation_warehousing_and_utilities_net_income_less_net_lo", -- Transportation warehousing and utilities net income less net loss amount.
    "transportation_warehousing_and_utilities_total_tax", -- Transportation warehousing and utilities total tax amount.
    "returns_reporting_tax_liability_in_information_and_communicatio", -- Number of returns reporting tax liability in information and communications.
    "information_and_communications_net_income_less_net_loss", -- Information and communications net income less net loss amount. 
    "information_and_communications_total_tax", -- Information and communications total tax amount.
    "total_returns_reporting_tax_liability_in_finance_insurance_and_", -- Total number of returns reporting tax liability in the finance, insurance, and real estate group.
    "retail_trade_total_tax", -- Retail trade total tax amount.
    "retail_trade_net_income_less_net_loss", -- Retail trade net income less net loss amount. 
    "returns_reporting_tax_liability_in_retail_trade", -- Number of returns reporting tax liability in retail trade.
    "wholesale_trade_total_tax", -- Wholesale trade total tax amount.
    "wholesale_trade_net_income_less_net_loss", -- Wholesale trade net income less net loss amount.
    "returns_reporting_tax_liability_in_wholesale_trade", -- Number of returns reporting tax liability in wholesale trade.
    "total_trade_total_tax", -- Total trade group total tax amount.
    "total_trade_net_income_less_net_loss", -- Total trade group net income less net loss amount. 
    "total_returns_reporting_tax_liability_in_trade", -- Total number of returns reporting tax liability in the trade group (wholesale and retail trade).
    "other_services_total_tax", -- Other services total tax amount.
    "other_services_net_income_less_net_loss", -- Total other services net income less net loss amount.  
    "returns_reporting_tax_liability_in_other_services", -- Number of returns reporting tax liability in other services.
    "health_services_total_tax", -- Health services total tax amount.
    "health_services_net_income_less_net_loss", -- Total health services net income less net loss amount.
    "unknown_net_income_less_net_loss",
    "total_net_income_less_net_loss_for_all_industry_categories", -- Total net income less net loss for all industry categories amount.
    "returns_reporting_tax_liability_in_health_services", -- Number of returns reporting tax liability in health services.
    "arts_entertainment_and_recreation_services_total_tax", -- Arts, entertainment, and recreation services total tax amount.
    "arts_entertainment_and_recreation_services_net_income_less_net_", -- Total arts, entertainment, and recreation services net income less net loss amount. 
    "returns_reporting_tax_liability_in_arts_entertainment_and_recre", -- Number of returns reporting tax liability in arts, entertainment, and recreation services.
    "accommodation_and_food_services_total_tax", -- Accommodation and food services total tax amount.
    "accommodation_and_food_services_net_income_less_net_loss", -- Total accommodation and food services net income less net loss amount.  
    "returns_reporting_tax_liability_in_accommodation_and_food_servi", -- Number of returns reporting tax liability in accommodation and food services.
    "administrative_services_total_tax", -- Administrative services total tax amount.
    "administrative_services_net_income_less_net_loss", -- Total administrative services net income less net loss amount.  
    "returns_reporting_tax_liability_in_administrative_services", -- Number of returns reporting tax liability in administrative services.
    "total_finance_insurance_and_real_estate_total_tax", -- Total Tax	The total finance, insurance, and real estate group total tax amount.
    "total_finance_insurance_and_real_estate_net_income_less_net_los", -- Total of the finance, insurance, and real estate group net income less net loss amount. 
    "returns_reporting_tax_liability_in_finance_investment_and_insur", -- Number of returns reporting tax liability in finance investment and insurance.
    "finance_investment_and_insurance_net_income_less_net_loss", -- Finance investment and insurance net income less net loss amount.
    "finance_investment_and_insurance_total_tax", -- Finance investment and insurance total tax amount.
    "total_tax_for_all_industry_categories", -- Total tax for all industry categories amount.
    "returns_reporting_tax_liability_in_unknown", -- Number of returns report in the unknown industry category
    "unknown_total_tax", -- Unknown total tax amount
    "taxable_year", -- Taxable year for which tax returns were filed in a number format that can be used to filter and sort, as well as display in charts.
    "corporation_type", -- Specifies C or S corporation as the type.
    "returns_reporting_tax_liability_in_agriculture_forestry_and_fis" -- Number of returns reporting tax liability in agriculture, forestry, and fishing.
FROM
    "ftb-ca-gov/c10a-and-c10b-tax-liability-by-industry-c-and-s-sgsk-qj69:latest"."c10a_and_c10b_tax_liability_by_industry_c_and_s"
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 ftb-ca-gov/c10a-and-c10b-tax-liability-by-industry-c-and-s-sgsk-qj69 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 ftb-ca-gov/c10a-and-c10b-tax-liability-by-industry-c-and-s-sgsk-qj69: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 ftb-ca-gov/c10a-and-c10b-tax-liability-by-industry-c-and-s-sgsk-qj69

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 ftb-ca-gov/c10a-and-c10b-tax-liability-by-industry-c-and-s-sgsk-qj69:latest

This will download all the objects for the latest tag of ftb-ca-gov/c10a-and-c10b-tax-liability-by-industry-c-and-s-sgsk-qj69 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 ftb-ca-gov/c10a-and-c10b-tax-liability-by-industry-c-and-s-sgsk-qj69: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 ftb-ca-gov/c10a-and-c10b-tax-liability-by-industry-c-and-s-sgsk-qj69: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, ftb-ca-gov/c10a-and-c10b-tax-liability-by-industry-c-and-s-sgsk-qj69 is just another Postgres schema.

Related Documentation:

Loading...