austintexas-gov/issued-construction-permits-3syk-w9eu

  • blds
  • building
  • development
  • driveway
  • electrical
  • + 8

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 procotol. 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 issued_construction_permits table in this repository, by referencing it like:

"austintexas-gov/issued-construction-permits-3syk-w9eu:latest"."issued_construction_permits"

or in a full query, like:

SELECT 
    ":id", -- Socrata column ID
    "contractor_city", -- Contractor city
    "total_lot_sq_ft", -- The total square footage attributed to the lot size.
    "calendar_year_issued", -- Calendar Year corresponding to when the Permit was issued
    "certificate_of_occupancy", -- Yes or No field to specify if the Certificate of Occupancy was required for this permit. This information applies only to Building Permits. 
    ":@computed_region_rxpj_nzrk",
    ":@computed_region_8spj_utxs",
    "medgas_valuation_remodel",
    "masterpermitnum", -- If the permit is listed as the child of another permit, this is the Project ID of that parent permit.  A building permit's (BP) master permit number will reference the Plan Review Project ID, while trades under that BP will reference the BP's ID as their master.  This may also be called the "parent folderRSN".
    "project_id", -- ID associated with the permit within the database.  Also referred to as the FolderRSN.
    "day_issued", -- Day of the week the permit was issued
    "location",
    "contractor_zip", -- Contractor zip
    "jurisdiction", -- Jurisdiction of permit property
    "contractor_address1", -- Contractor street address line 1
    "contractor_address2", -- Contractor street address line 2
    "applicant_org", -- Organization the applicant is associated with.
    "original_address1", -- Property address associated with the permit
    "medgas_valuation",
    "applicant_address2", -- Applicant address line 2
    "applicantzip", -- Applicant zip code
    "permit_type_desc", -- Description of the Permit Type
    "legal_description", -- Legal Description of the property associated with the permit.
    "mechanical_valuation_remodel",
    "mechanical_valuation",
    "electrical_valuation",
    "building_valuation_remodel",
    "total_valuation_remodel", -- Total dollar valuation for remodeling aspects of the job
    "total_new_add_sqft",
    "latitude",
    "total_existing_bldg_sqft",
    ":@computed_region_i2aj_cj5t",
    ":@computed_region_a3it_2a2z",
    ":@computed_region_qwte_z96m",
    ":@computed_region_xzeg_zdjk",
    "location_address",
    "location_city",
    "original_state",
    "issued_in_last_30_days", -- Yes/No value to indicate if the permit was issued in the last 30 days.  This field is evaluated using the last date that the data was refreshed.
    "location_state",
    "location_zip",
    "expiresdate", -- Date on which the permit will/would have expire(d)
    ":@computed_region_e9j2_6w3z",
    "permit_class_mapped", -- Indicates if the permit is intended for Residential or Commercial.  This mapping is derived from the PermitClass field (if the Class starts with "R", it is residential, otherwise it is commercial)
    ":@computed_region_m2th_e4b7",
    "link",
    ":@computed_region_q9nd_rr82",
    "contractor_company_name", -- Company name of the primary contractor associated with the permit.
    "contractor_full_name", -- Full name of the contractor
    "contractor_phone", -- Contractor phone number
    "permit_class", -- Sub Type of the permit
    "work_class", -- Work type of the permit
    "permit_number", -- Permit number
    "longitude",
    "electrical_valuation_remodel",
    "permit_location",
    "description", -- Detailed description of work permitted
    "plumbing_valuation_remodel",
    "applicant_phone", -- Applicant phone
    "building_valuation",
    "number_of_floors",
    "total_job_valuation", -- Total dollar valuation for entire job for each building permit (e.g. will include Building, Electrical, Mechanical, and Plumbing valuations, but not other Building Permits in the same project)
    "tcad_id", -- TCAD_ID aligns with the Geographic ID field on the TravisCAD.org website when performing a property search.
    "statusdate", -- Indicates the last time the status or ExpiresDate of a permit was updated in the AMANDA database.
    "issue_date", -- Date on which the permit was issued
    "applicant_full_name", -- Full name of the applicant
    "status_current", -- Current status of permit
    "completed_date", -- Date on which the permit was completed
    "plumbing_valuation",
    "applicant_address1", -- Applicant address line 1
    "original_city", -- City of the property associated with the permit
    "contractor_trade", -- Indicates contractor trade.
    "fiscal_year_issued", -- Fiscal Year corresponding to when the permit was issued
    "condominium",
    "council_district", -- Council District associated with the permit property location
    "permittype", -- Raw values indicating type of permit in abbreviated format
    "housing_units", -- Number of household units for a given building
    "remodel_repair_sqft",
    "applieddate", -- Date on which the permit was applied.  This relates to the original Plan Review application submission where applicable.
    "issue_method", -- Permit issuance method.  "Permit Center" represents any permit which a permit center technician manually issued (e.g., will include fax based requests).  "Online" includes permits issued through the website including Austin Build and Connect or Customer Self Assignment.
    "original_zip",
    "applicant_city" -- Applicant city
FROM
    "austintexas-gov/issued-construction-permits-3syk-w9eu:latest"."issued_construction_permits"
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 austintexas-gov/issued-construction-permits-3syk-w9eu with SQL in under 60 seconds.

This repository is an "external" repository. That means it's hosted elsewhere, in this case at data.austintexas.gov. When you queryaustintexas-gov/issued-construction-permits-3syk-w9eu:latest on the DDN, we "mount" the repository using the socrata mount handler. The mount handler proxies your SQL query to the upstream data source, translating it from SQL to the relevant language (in this case SoQL).

We also cache query responses on the DDN, but we run the DDN on multiple nodes so a CACHE_HIT is only guaranteed for subsequent queries that land on the same node.

Query Your Local Engine

Install Splitgraph Locally
bash -c "$(curl -sL https://github.com/splitgraph/splitgraph/releases/latest/download/install.sh)"
 

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 (like this repository), 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, where the author has pushed Splitgraph Images to the repository, you can "clone" and/or "checkout" the data using sgr cloneand sgr checkout.

Mounting Data

This repository is an external repository. It's not hosted by Splitgraph. It is hosted by data.austintexas.gov, and Splitgraph indexes it. This means it is not an actual Splitgraph image, so you cannot use sgr clone to get the data. Instead, you can use the socrata adapter with the sgr mount command. Then, if you want, you can import the data and turn it into a Splitgraph image that others can clone.

First, install Splitgraph if you haven't already.

Mount the table with sgr mount

sgr mount socrata \
  "austintexas-gov/issued-construction-permits-3syk-w9eu" \
  --handler-options '{
    "domain": "data.austintexas.gov",
    "tables": {
        "issued_construction_permits": "3syk-w9eu"
    }
}'

That's it! Now you can query the data in the mounted table like any other Postgres table.

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, austintexas-gov/issued-construction-permits-3syk-w9eu is just another Postgres schema.

Related Documentation: