cityofnewyork-us/low-income-housing-tax-credits-awarded-by-hpd-p8i7-ix2s
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 low_income_housing_tax_credits_awarded_by_hpd table in this repository, by referencing it like:

"cityofnewyork-us/low-income-housing-tax-credits-awarded-by-hpd-p8i7-ix2s:latest"."low_income_housing_tax_credits_awarded_by_hpd"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "credit_year", -- Year in which the DOCE was issued
    "total_tax_credit_units", -- Total number of tax credit units in the project
    "applicant_state", -- State location of the Parent Entity applying for Tax Credits
    "applicant_phone", -- Phone number of Parent Entity applying for Tax Credits
    "new_construction", -- Identifies if the project is New Construction or Rehabilitation
    "applicant_borough", -- New York City’s boroughs are five county-level administrative divisions, with each one also being a state county. (Manhattan - New York County; Bronx - Bronx County; Brooklyn - Kings County; Queens - Queens County; Staten Island - Richmond County). NYC’s boroughs have existed since the consolidation of the city in 1898.
    "total_units", -- Total number of units in the project
    "latitude", -- Name of Parent Entity applying for Tax Credits
    "doce_date", -- Date the DOCE was signed
    "applicant_address_2", -- Floor or Suite in the building address of the Parent Entity applying for Tax Credits
    "project_borough", -- Borough in which project is physically located
    "doce_amount", -- Amount of credits identified in the Determination of Credit Eligibility (DOCE)
    "applicant_city", -- City location of the Parent Entity applying for Tax Credits
    "applicant_house_number", -- House number of the street of the Parent Entity applying for Tax Credits
    "applicant_street_name", -- Street name of the Parent Entity applying for Tax Credits
    "applicant_postcode", -- ZipCode of the address of the Parent Entity applying for Tax Credits
    "project_name", -- Specific name given to the project
    "application_year", -- The year the tax credit application was received
    "latitude_1", -- Latitude of the site's location
    "longitude", -- Longitude of the site's location
    "community_board", -- Community Boards are volunteer-run neighborhood organizations that work on all kinds of issues pertinent to their communities, often working with elected city officials in doing so. Community Board members, who can be as young as 16, are appointed by Borough Presidents and City Council representatives. They serve two-year terms. There are 59 Community Boards in NYC, each of which represents a unique geographical area, known as a Community District. Note: as a column header, “Community Board” (which refers to a group of Board members) is often used to mean “Community District” (the geographical area) instead.
    "council_district", -- The City Council is the lawmaking body of NYC, on equal footing with the mayor in terms of governing power. Besides legislating, the Council has sole approval power over the city budget, and is the final decision-maker in land use matters. There are 51 City Council members in total, each representing a unique geographical area, called a Council District.
    "bin", -- The BIN (Building Identification Number) is a unique 7-digit number assigned to every known building by the Department of City Planning (DCP), the first digit of which is the borough code. BINs allow city agencies to process and match building-related data easily and in a consistent manner. 
    "bbl", -- The BBL (Borough, Block, and Lot) is a unique combination of three numeric codes - a 1-digit borough number, a block number (up to 5 digits) and a lot number (up to 4 digits) -- designated and modified by the Department of Finance (DOF). BBLs are used by various city agencies to identify real estate for taxes, zoning, construction, and other purposes.
    "census_tract", -- The Census Tract (Census 2020) field indicates the U.S. Census Tract where the site is located. Please note that as part of the geocoding process, leading and trailing zeros are dropped
    "nta" -- NTAs are small area boundaries, created by the Department of City Planning (DCP) to aggregate population projections in a small area.. Each NTA approximates a minimum population of 15,000. While NTAs were initially created to support PlaNYC, the thirty-year (2000-2030) sustainability plan for NYC, NTAs are now also being used to present data from the Decennial Census and American Community Survey. NTA boundaries and their associated names do not definitively represent neighborhood boundaries.
FROM
    "cityofnewyork-us/low-income-housing-tax-credits-awarded-by-hpd-p8i7-ix2s:latest"."low_income_housing_tax_credits_awarded_by_hpd"
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 cityofnewyork-us/low-income-housing-tax-credits-awarded-by-hpd-p8i7-ix2s 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 cityofnewyork-us/low-income-housing-tax-credits-awarded-by-hpd-p8i7-ix2s: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 cityofnewyork-us/low-income-housing-tax-credits-awarded-by-hpd-p8i7-ix2s

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 cityofnewyork-us/low-income-housing-tax-credits-awarded-by-hpd-p8i7-ix2s:latest

This will download all the objects for the latest tag of cityofnewyork-us/low-income-housing-tax-credits-awarded-by-hpd-p8i7-ix2s 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 cityofnewyork-us/low-income-housing-tax-credits-awarded-by-hpd-p8i7-ix2s: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 cityofnewyork-us/low-income-housing-tax-credits-awarded-by-hpd-p8i7-ix2s: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, cityofnewyork-us/low-income-housing-tax-credits-awarded-by-hpd-p8i7-ix2s is just another Postgres schema.

Related Documentation:

Loading...