ny-gov/new-york-state-corporate-tax-credits-by-major-84qh-f5nv
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 new_york_state_corporate_tax_credits_by_major table in this repository, by referencing it like:

"ny-gov/new-york-state-corporate-tax-credits-by-major-84qh-f5nv:latest"."new_york_state_corporate_tax_credits_by_major"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "credit_type_sort_order", -- Indicator to sort the credit type.
    "tax_article", -- The dataset only contains data for corporate franchise taxpayers filing under Article 9‐A of the Tax Law. It does not include statistics for taxpayers filing as banks under Article 32*, insurance companies filing under Article 33, or taxpayers filing under any of the various sections of Article 9. Nor does it provide data for taxpayers claiming credits under Article 22, the Personal Income Tax. *Starting in 2015, banks and general business corporations file under the same tax article – (Article 9‐A).
    "mean_amount_of_credit", -- Average amount of credit in a given category.
    "naics_description", -- The major industry group category is based on the North American Industry Classification System (NAICS). Taxpayers report their principal business activity using NAICS codes from their federal tax returns. Therefore, the NAICS code may not be indicative of the type of activities actually being undertaken in New York. The NAICS descriptions provided within the dataset may vary between years because NAICS codes are reviewed every five years (in the years ending in ‘2’ or ‘7’) for potential revisions so that the classification system can keep pace with the changing economy.
    "notes", -- Disclosure identifies whether the data in columns have a value, but is not reported. d/ ‐ Tax Law secrecy provisions prohibit the disclosure of data for instances of less than three taxpayers. 1/ Chapter 56 of the Laws of 2011 created the New York Youth Works Tax Credit Program. Chapter 56 of the Laws of 2015 renamed the program the Urban Youth Jobs Program Tax Credit. Chapter 59 of the Laws of 2017 further renamed the program the New York Youth Jobs Program Tax Credit. 2/ Beginning in 2016 the Beer Production Credit was renamed the Alcoholic Beverage Production Credit and expanded to include wine, liquor and cider.
    "number_of_taxpayers", -- Number of taxpayers taking the credit.
    "amount_of_credit", -- The amount of the credit generated, claimed, used, refunded, or carried forward in the tax year based on the credit type.
    "median_amount_of_credit", -- The central value representing an equal number of credit values above and below it.
    "group_sort_order", -- Indicator to sort by NAICS description.
    "percent_of_credit", -- Percentage of the amount of credit by NAICS description within each credit type.
    "credit_name", -- Name of the credit. For a list of credits with detailed credit information and expiration dates, see the link to Article 9‐A credit provisions, under Additional Resources.
    "credit_type", -- Profile of credit values consisting of the components credit earned, claimed, used and carried forward. Credit earned is the amount of credit generated in the current tax year. Credit claimed is the amount of credit that taxpayers have available to use and refund during the taxable year. Credit used is the amount of credit that taxpayers actually apply to their tax liability. Credit carried forward is any unused amount of credit that is allowed to offset tax liability in future years.
    "tax_year" -- Tax year of the credit claim; typically, the year preceding the calendar year, although extensions and fiscal years may result in a longer interval.
FROM
    "ny-gov/new-york-state-corporate-tax-credits-by-major-84qh-f5nv:latest"."new_york_state_corporate_tax_credits_by_major"
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 ny-gov/new-york-state-corporate-tax-credits-by-major-84qh-f5nv 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 ny-gov/new-york-state-corporate-tax-credits-by-major-84qh-f5nv: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 ny-gov/new-york-state-corporate-tax-credits-by-major-84qh-f5nv

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 ny-gov/new-york-state-corporate-tax-credits-by-major-84qh-f5nv:latest

This will download all the objects for the latest tag of ny-gov/new-york-state-corporate-tax-credits-by-major-84qh-f5nv 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 ny-gov/new-york-state-corporate-tax-credits-by-major-84qh-f5nv: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 ny-gov/new-york-state-corporate-tax-credits-by-major-84qh-f5nv: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, ny-gov/new-york-state-corporate-tax-credits-by-major-84qh-f5nv is just another Postgres schema.

Related Documentation:

Loading...