citydata-mesaaz-gov/commercial-vacancy-all-properties-73s5-mf6u
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 commercial_vacancy_all_properties table in this repository, by referencing it like:

"citydata-mesaaz-gov/commercial-vacancy-all-properties-73s5-mf6u:latest"."commercial_vacancy_all_properties"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "property_type", -- The property category type including  Office, Retail, Flex and Industrial, and All Properties.
    "average_gross_rent_for_office", -- The average gross rent cost per square foot for office space, which includes taxes, insurance and maintenance (the three nets).
    "all_service_type_rent_sublet",
    "calendar_year_and_quarter", -- The 3-month period, or quarter, that the data pertains to.
    "vacant_square_footage", -- Total square footage of all commercial property in Mesa that is vacant, or unoccupied.
    "sublet_available_square_footage",
    "sublet_available_vacant_square_footage",
    "total_percent_vacant_and", -- Percentage of the Inventory Square Footage in Mesa that is vacant and available.
    "total_square_footage_occupied", -- The amount of commercial property square footage in Mesa that is currently occupied.
    "total_percent_occupied", -- Percentage of the Inventory Square Footage in Mesa that is occupied.
    "sublet_square_footage_in_net_absorption",
    "sublet_number_of_leasing_activity_deals",
    "total_number_of_leasing", -- The number of new leases that occurred in the given time period for all retail space.
    "direct_square_footage_of_leasing_activity",
    "number_of_buildings_delivered", -- The total number of new commercial buildings that were completed in a given period of time.
    "nnn_rent_overall", -- Overall average "Three Nets" (NNN) rent cost per square foot, which does not include taxes, insurance and maintenance (the three nets).
    "location", -- Indicates if the row is part of the Downtown area or not.
    "calendar_year", -- The year that the data pertains to.
    "direct_number_of_leasing_activity_deals",
    "total_square_footage_of", -- The total amount of square footage absorbed in the Leasing Activity Deals Total.
    "average_sublet_gross_rent_for_office_space",
    "total_available_square_footage", -- Total square footage of all commercial property in Mesa that is listed and available. This is regardless of whether the space is vacant or not. For example, a building may be available, but not vacant, as it may have tenants, but is still available for sale.
    "total_square_footage_in_gross", -- The total amount of commercial square footage in Mesa that was gross absorbed, which is the total square feet occupied during a given time period, without including the amount of space vacated in that same period of time.
    "average_direct_gross_rent_for_office_space",
    "nnn_rent_direct",
    "average_base_rent_for_sublet_office_space",
    "nnn_rent_sublet",
    "building_inventory_square", -- Total square footage of all existing commercial property present in Mesa.
    "direct_vacancy_rate",
    "direct_percent_vacant_and_available",
    "direct_square_footage_in_net_absorption",
    "quarter_date", -- The 3-month period, or quarter, that the data pertains to in date format.
    "direct_available_vacant_square_footage",
    "total_available_vacant_square", -- Total square footage of all commercial property in Mesa that is vacant and also available.
    "average_base_rent_for_direct_office_space",
    "total_square_footage_of_1", -- The total amount of commercial square footage delivered to the market from the completed buildings in a given period of time.
    "sublet_percent_available",
    "sublet_percent_vacant_and_available",
    "sublet_square_footage_in_gross_absorption",
    "sublet_square_footage_of_leasing_activity",
    "number_of_buildings_under", -- The total number of new commercial buildings that are under construction in a given period of time.
    "all_service_type_rent_overall", -- Overall rent for all service types
    "average_base_rent_for_office", -- The average base rent cost per square foot for office space, which does not include taxes, insurance and maintenance (the three nets).
    "sublet_vacancy_rate",
    "total_square_footage_in_net", -- The total amount of commercial square footage in Mesa that was net absorbed, which is the total square feet occupied less the total space vacated over a period of time.
    "all_service_type_rent_direct",
    "direct_vacant_square_footage",
    "direct_available_square_footage",
    "total_percent_available", -- Percentage of the Inventory Square Footage in Mesa that is available.
    "direct_square_footage_in_gross_absorption",
    "total_square_footage_under", -- The total amount of square footage that is currently under construction in a given period of time.
    "building_inventory", -- Total number of existing commercial buildings in Mesa.
    "sublet_vacant_square_footage",
    "vacancy_rate", -- Percentage of the Inventory Square Footage in Mesa that is vacant.
    "direct_percent_available"
FROM
    "citydata-mesaaz-gov/commercial-vacancy-all-properties-73s5-mf6u:latest"."commercial_vacancy_all_properties"
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 citydata-mesaaz-gov/commercial-vacancy-all-properties-73s5-mf6u 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 citydata-mesaaz-gov/commercial-vacancy-all-properties-73s5-mf6u: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 citydata-mesaaz-gov/commercial-vacancy-all-properties-73s5-mf6u

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 citydata-mesaaz-gov/commercial-vacancy-all-properties-73s5-mf6u:latest

This will download all the objects for the latest tag of citydata-mesaaz-gov/commercial-vacancy-all-properties-73s5-mf6u 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 citydata-mesaaz-gov/commercial-vacancy-all-properties-73s5-mf6u: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 citydata-mesaaz-gov/commercial-vacancy-all-properties-73s5-mf6u: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, citydata-mesaaz-gov/commercial-vacancy-all-properties-73s5-mf6u is just another Postgres schema.

Related Documentation:

Loading...