lacity/building-and-safety-certificate-of-occupancy-3f9m-afei
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 building_and_safety_certificate_of_occupancy table in this repository, by referencing it like:

"lacity/building-and-safety-certificate-of-occupancy-3f9m-afei:latest"."building_and_safety_certificate_of_occupancy"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "zone", -- The designated zone of the property or lot that determines the allowed use, maximum height, allowable area, required yards, and any other requirements specific to the property or lot.
    "applicant_business_name", -- If applicable, permit applicant's business name.
    "license_expiration_date", -- Contractor license expiration date.
    "contractor_state", -- "State" portion of contractor's address.
    "valuation", -- The property/structure valuation amount is used to calculate the building permit fee and all fees calculated as percentage of the building fee. For all building permit types, except for Grading, the valuation is measured in dollars. For Grading permit applications, the valuation is measured in cubic yards of soil removed or added.
    "status_date", -- The date when the CofO status took effect.
    "applicant_last_name", -- Last name of the permit applicant.
    "assessor_book", -- "Book" portion of the Los Angeles County Tax Assessor "Book-Page-Parcel" number.
    "address_end", -- Ending house number of property address on permit application. Example 1: For "200 - 200 N Main Ave", Address End is 200. Example 2: For "202 1/4 - 204 1/2 N Main St SE", Address End is 204.
    "census_tract", -- A geographic area for population-related analysis.
    "applicant_address_3", -- The city and state of the permit applicant's address.
    "principal_middle_name", -- Middle name of the contractor or personnel currently associated with the license.
    "principal_first_name", -- First name of the contractor or personnel currently associated with the license.
    "contractor_city", -- "City" portion of contractor's address.
    "contractors_business_name", -- If applicable, the contractor's business name.
    "work_description", -- Describes the work to be performed under the permit application.
    "street_direction", -- Street direction of property address for permit application. Example 1: For "200 - 200 Main Ave", Street Direction is null. Example 2: For "202 1/4 - 204 1/2 N Main St SE", Street Direction is N.
    "address_start", -- Beginning house number of property address on permit application. Example 1: For "200 - 200 N Main Ave", Address Start is 200. Example 2: For "202 1/4 - 204 1/2 N Main St SE", Address Start is 202.
    "issue_date", -- The date when the permit was issued.
    "cofo_issue_date", -- The date when the CofO was issued.
    "cofo_number", -- System-generated Certificate of Occupancy (CofO) number.
    "occupancy", -- Occupancy is the approved use for the structure.
    "applicant_address_2", -- The unit portion of the permit applicant's address.
    "permit_type", -- Permit application type.
    "assessor_parcel", -- "Parcel" portion of the Los Angeles County Tax Assessor "Book-Page-Parcel" number.
    "address_fraction_end", -- Ending house number fraction of property address on permit application. Example 1: For "200 - 200 N Main Ave", Address Fraction End is null. Example 2: For "202 1/4 - 204 1/2 N Main St SE", Address Fraction End is 1/2.
    "applicant_address_1", -- The street address portion of the permit applicant's address.
    "applicant_first_name", -- First name of the permit applicant.
    "unit_range_end", -- Ending unit number of property address on permit application. Example 1: For "200 - 200 N Main Ave, #1-#8", Unit Range End is #8. Example 2: For "202 1/4 - 204 1/2 N Main St SE", Unit Range End is null.
    "unit_range_start", -- Beginning unit number of property address on permit application. Example 1: For "200 - 200 N Main Ave, #1-#8", Unit Range Start is #1. Example 2: For "202 1/4 - 204 1/2 N Main St SE", Unit Range Start is null.
    "street_suffix", -- Street suffix of property address for permit application. Example 1: For "200 - 200 Main Ave", Street Suffix is Ave. Example 2: For "202 1/4 - 204 1/2 N Main St SE", Street Suffix is St.
    "pcis_permit", -- This is the permit number assigned by the Plan Check and Inspection System as soon as an application for a permit has been filed. Before a permit is issued, the number is known as the Application Number. After the permit is issued, this same number becomes the Permit Number.
    "reference_old_permit", -- A sequential reference number issued by the Cashiering System, and used to file and retrieve original paper copies.
    "tract", -- "Tract" portion of a property's legal description as recorded with the Los Angeles County Recorder.
    "license", -- Contractor's license number.
    "floor_area_l_a_zoning_code_definition", -- Floor area as defined in the Los Angeles Zoning Code.
    "address_fraction_start", -- Beginning fraction of property address on permit application. Example 1: For "200 - 200 N Main Ave", Address Fraction Start is null. Example 2: For "202 1/4 - 204 1/2 N Main St SE", Address Fraction Start is 1/4.
    "of_stories", -- Number of stories.
    "initiating_office", -- Office location where the permit application is initiated, not necessarily issued.
    "latitude_longitude_city",
    "latitude_longitude", -- GPS location point.
    "floor_area_l_a_building_code_definition", -- Floor area as defined in the Los Angeles Building Code.
    "principal_last_name", -- Last name of the contractor or personnel currently associated with the license.
    "license_type", -- Contractor's license type (class code).
    "contractor_address", -- "Street address" portion of contractor's address.
    "zip_code", -- Zip code of property address for permit application.
    "suffix_direction", -- Street suffix direction of property address for permit application. Example 1: For "200 - 200 N Main Ave", Suffix Direction is null. Example 2: For "202 1/4 - 204 1/2 N Main St SE", Suffix Direction is SE.
    "street_name", -- Street name of property address for permit application.
    "project_number", -- A number used to associate a permit application with a specific construction or a development project consisting of several permit applications.
    "lot", -- "Lot" portion of a property's legal description as recorded with the Los Angeles County Recorder.
    "block", -- "Block" portion of a property's legal description as recorded with the Los Angeles County Recorder.
    "assessor_page", -- "Page" portion of the Los Angeles County Tax Assessor "Book-Page-Parcel" number.
    "latest_status", -- The latest status of the Certificate of Occupancy.
    "of_residential_dwelling_units", -- Number of dwelling units for a residential building.
    "latitude_longitude_state",
    "permit_category", -- Permit category is used to determine how the permit application will be handled within the LADBS public counter and regular plan check business process.
    "latitude_longitude_address",
    ":@computed_region_ur2y_g4cx",
    ":@computed_region_2dna_qi2s",
    ":@computed_region_tatf_ua23",
    ":@computed_region_k96s_3jcv",
    ":@computed_region_qz3q_ghft",
    ":@computed_region_kqwf_mjcx",
    "latitude_longitude_zip",
    "permit_sub_type", -- The permit sub-type determines whether the permit application is for a 1 or 2 family dwelling, a multi-family dwelling, or a commercial structure.
    "event_code" -- An event code, usually synonymous with a disaster code, represents permits issued related to repairing, demolishing, or rebuilding structures damaged from a disaster.
FROM
    "lacity/building-and-safety-certificate-of-occupancy-3f9m-afei:latest"."building_and_safety_certificate_of_occupancy"
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 lacity/building-and-safety-certificate-of-occupancy-3f9m-afei 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 lacity/building-and-safety-certificate-of-occupancy-3f9m-afei: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 lacity/building-and-safety-certificate-of-occupancy-3f9m-afei

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 lacity/building-and-safety-certificate-of-occupancy-3f9m-afei:latest

This will download all the objects for the latest tag of lacity/building-and-safety-certificate-of-occupancy-3f9m-afei 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 lacity/building-and-safety-certificate-of-occupancy-3f9m-afei: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 lacity/building-and-safety-certificate-of-occupancy-3f9m-afei: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, lacity/building-and-safety-certificate-of-occupancy-3f9m-afei is just another Postgres schema.

Related Documentation:

Loading...