ny-gov/brownfield-redevelopment-credit-beginning-calendar-vud8-75x8
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 brownfield_redevelopment_credit_beginning_calendar table in this repository, by referencing it like:

"ny-gov/brownfield-redevelopment-credit-beginning-calendar-vud8-75x8:latest"."brownfield_redevelopment_credit_beginning_calendar"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "georeference", -- Open Data/Socrata-generated geocoding information from supplied address components.
    "site_preparation_component_costs", -- Generally, costs related to the remediation of a brownfield site (cleanup costs). Eligible costs differ depending on a sites date of acceptance in to the Brownfield Cleanup Program.
    "total_credit", -- The sum of component credits for the Site Preparation Credit, the Tangible Property Credit, and the OnSite Groundwater Remediation Credit.
    "total_cost", -- The sum of component costs for the Site Preparation Credit, the Tangible Property Credit, and the OnSite Groundwater Remediation Credit.
    "onsite_groundwater_remediation_credit", -- The product of the on-site groundwater remediation costs multiplied by the applicable percentage.
    "onsite_groundwater_remediation_cost", -- Generally, costs related to the remediation of groundwater on a brownfield site (cleanup costs). Eligible costs differ depending on a sites date of acceptance in to the Brownfield Cleanup Program.
    "en_zone", -- Is site located in an Environmental Zone - Yes/No An environmental zone (EN-Zone) is an area designated as such by the Commissioner of Labor. Such areas shall be census tracts that satisfy certain poverty and unemployment metrics.
    ":@computed_region_kjdx_g34t", -- This column was automatically created in order to record in what polygon from the dataset 'Counties' (kjdx-g34t) the point in column 'georeference' is located.  This enables the creation of region maps (choropleths) in the visualization canvas and data lens.
    ":@computed_region_yamh_8v7k", -- This column was automatically created in order to record in what polygon from the dataset 'NYS Municipal Boundaries' (yamh-8v7k) the point in column 'georeference' is located.  This enables the creation of region maps (choropleths) in the visualization canvas and data lens.
    ":@computed_region_wbg7_3whc", -- This column was automatically created in order to record in what polygon from the dataset 'New York Zip Codes' (wbg7-3whc) the point in column 'georeference' is located.  This enables the creation of region maps (choropleths) in the visualization canvas and data lens.
    "municipality", -- City, town, borough, county, or village name where project is located For the location parameters and site description, see the link to “DEC Resources” under Additional Resources.
    "project_site_name", -- Brownfield Certificate of Completion (COC) number and site name per the Department of Environmental Conservation (DEC). For a list of COCs issued by the DEC, see the link to “DEC Resources” under Additional Resources.
    "notes", -- 1/ Information from amended return that supersedes a previously filed return; original filing removed from public report 2/ Credit form not filed so no cost data available; credit data taken from main form; site information taken from a pass-through entity 3/ The Department of Environmental Conservation (DEC) accepted this site into the Brownfield Cleanup Program on or after June 23, 2008, but prior to July 1, 2015 4/ The Department of Environmental Conservation (DEC) accepted this site into the Brownfield Cleanup Program on or after July 1, 2015 5/ Qualified site located in a Brownfield Opportunity Area 6/ Negative amounts indicate credit recapture 7/ Qualified site developed as an affordable housing project 8/ Combined entry of multiple sites. Total credit also includes credit from site C828125 River Park Commons-Townhouses. It is not possible to do site-specific costs/credit on how the credit was claimed in the aggregate.
    "tax_year", -- Tax year of the credit claim; typically the year preceding the calendar year, although extensions and fiscal years may result in claims for a tax year being filed several calendar years later.
    "taxpayer_name", -- Name of the entity earning the credit.
    "project_site_code", -- Brownfield Certificate of Completion (COC) code number per the Department of Environmental Conservaction. For a list of COCs issued by the DEC, see the link to “DEC Resources” under Additional Resources.
    "tangible_property_component_credit", -- The product of the cost of qualified tangible property multiplied by the applicable percentage. The credit is also subject to varying caps dependent upon a site’s use and the amount of cleanup costs.
    "site_preparation_component_credit", -- The product of the eligible site preparation costs for the qualified site multiplied by the applicable percentage.
    "county", -- County Name
    "dec_region", -- 1-9 depending on site location; code assigned by Department of Environmental Conservation corresponding to regions within NYS. 1 = Long Island 2 = New York City 3 = Lower Hudson Valley 4 = Capital Region/Northern Catskills 5 = Eastern Adirondacks/Lake Champlain 6 = Western Adirondacks/Eastern Lake Ontario 7 = Central New York 8 = Western Finger Lakes 9 = Western New York For a list of the counties in each region, see the link to “DEC Resources” under Additional Resources.
    "tangible_property_component_costs", -- Generally, costs related to the redevelopment, such as construction of a building, occurring on a brownfield site. Eligible costs differ depending on a sites date of acceptance in to the Brownfield Cleanup Program.
    "calendar_year" -- Calendar year in which the tax return was filed
FROM
    "ny-gov/brownfield-redevelopment-credit-beginning-calendar-vud8-75x8:latest"."brownfield_redevelopment_credit_beginning_calendar"
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/brownfield-redevelopment-credit-beginning-calendar-vud8-75x8 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/brownfield-redevelopment-credit-beginning-calendar-vud8-75x8: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/brownfield-redevelopment-credit-beginning-calendar-vud8-75x8

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/brownfield-redevelopment-credit-beginning-calendar-vud8-75x8:latest

This will download all the objects for the latest tag of ny-gov/brownfield-redevelopment-credit-beginning-calendar-vud8-75x8 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/brownfield-redevelopment-credit-beginning-calendar-vud8-75x8: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/brownfield-redevelopment-credit-beginning-calendar-vud8-75x8: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/brownfield-redevelopment-credit-beginning-calendar-vud8-75x8 is just another Postgres schema.

Related Documentation:

Loading...