Query the Data Delivery Network
Query the DDNThe 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 property_information
table in this repository, by referencing it like:
"brla-gov/property-information-re5c-hrw9:latest"."property_information"
or in a full query, like:
SELECT
":id", -- Socrata column ID
"udod_name", -- Urban design overlay district as designated by the Unified Development Code
"city", -- The US Postal Service community name
"subd_id", -- The unique identifier for each subdivision record
"census_tract", -- US Census tract number
"property_info", -- Tract or property name for lots not located in a subdivision
"business_name", -- The official business name as recorded in the Occupational License
"lb_map", -- The retired City-Parish lot and block map number (1-267)
"voting_district", -- 19th Judicial District ward and voting precinct number
"enterprise_zone", -- Enterprise Zone name as designated by the State of Louisiana and City-Parish
"historic_landmark", -- National or Local historic landmark designation
"existing_land_use", -- The predominant current day land use character of the lot; definitions can be found on https://city.brla.gov/gis/ExistingLandUse.asp
"zoning_type", -- A designation approved by the Metropolitan Council that regulates the development of property; definitions can be found on https://city.brla.gov/gis/zoning.asp
"historic_district", -- National or Local historic district designation
"police_district", -- Baton Rouge Police Department district number
"st_ext", -- "EXT" is used when a street is designated as an extension of the original
"st_prefix_dir", -- Directional prefix (N, S, E, W) of the street
":@computed_region_hfgy_t898",
":@computed_region_8tu6_j4iw",
":@computed_region_idcr_7zcb",
"fire_district", -- The fire protection district name
"ward_number", -- Division of the Parish for property legal description purposes
"economic_dev_zone", -- One of the four sites designated in EBRP
"udd_name", -- Urban design district as designated by the Unified Development Code
"tax_section", -- Division of the Parish wards for property recordation purposes
"geo_location", -- Geographic location of the address consisting of Latitude and Longitude coordinates
"area_meas_acres", -- Area of the lot measured in acres
"block_group", -- US Census block group number
"block_num", -- For inner city lots that are part of a larger block or square
"lot_num", -- The lot number as designated on the final plat for each property record
"pla_dist", -- The City-Parish Planning Commission district number (1-16)
"business_naics_code", -- The designated North American Industrial Classification Standard (NAICS) Code
"business_id", -- The unique identifier for each business name record
"st_prefix_type", -- Type of street (Avenue, Boulevard, Rue, etc)
"address_no_complete", -- The complete street address number assigned to the property record
"design_level", -- A range of development standards that promote and encourage consistency in the quality of design throughout the City-Parish, defined by intensity of development and preferred urban form
"subdivision", -- The official subdivision name
"geo_location_state",
"zip", -- The US Postal Service ZIP code
"address_id", -- The identifier for the attribute information for each address record
"geo_location_zip",
"future_land_use", -- The planned land use for the lot as designated by the City-Parish comprehensive plan; definitions can be found on https://city.brla.gov/gis/FutureLandUse.asp
"full_address", -- Complete address number and street name
"sub_area", -- Planning Districts are divided into 3-5 subareas
"plss", -- The township, range, and section that the lot is bound by
"lot_location", -- Jurisdiction of the lot including Baker, Baton Rouge, Central, Zachary, or unincorporated area (EBRP)
"st_name", -- Official name of the street
"dotd_map", -- An area number designated by the Louisiana Department of Transportation and Development
"redevelopment_district", -- Old Town redevelopment district as designated by the Unified Development Code
"industrial_area", -- One of the six (6) Industrial Areas in EBRP as designated in the Plan of Government
"st_suffix_dir", -- Directional suffix (N, S, E, W) of the street
"council_dist_no", -- Metropolitan Council District number (1-12)
"school_district", -- East Baton Rouge, Baker, Central, and Zachary school system district numbers
"st_suffix_type", -- Type of street (Drive, Road, Highway, Boulevard, etc)
"geo_location_city",
"address_point_id", -- The unique identifier for each address point record
"lot_id", -- The 9 or 10 digit identifier for each lot (property) record
"geo_location_address"
FROM
"brla-gov/property-information-re5c-hrw9:latest"."property_information"
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 brla-gov/property-information-re5c-hrw9
with SQL in under 60 seconds.
Query Your Local Engine
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; sgr
can 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 clone
and sgr checkout
.
Cloning Data
Because brla-gov/property-information-re5c-hrw9: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 brla-gov/property-information-re5c-hrw9
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 brla-gov/property-information-re5c-hrw9:latest
This will download all the objects for the latest
tag of brla-gov/property-information-re5c-hrw9
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 brla-gov/property-information-re5c-hrw9: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 brla-gov/property-information-re5c-hrw9: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, brla-gov/property-information-re5c-hrw9
is just another Postgres schema.