citydata-mesaaz-gov/commercial-vacancy-all-properties-73s5-mf6u
Icon for Socrata external plugin

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
    "direct_vacant_square_footage",
    "sublet_vacancy_rate",
    "number_of_buildings_delivered", -- The total number of new commercial buildings that were completed in a given period of time.
    "average_base_rent_for_direct_office_space",
    "nnn_rent_overall", -- Overall average "Three Nets" (NNN) rent cost per square foot, which does not include taxes, insurance and maintenance (the three nets).
    "all_service_type_rent_overall", -- Overall rent for all service types
    "number_of_buildings_under", -- The total number of new commercial buildings that are under construction in a given period of time.
    "sublet_square_footage_of_leasing_activity",
    "sublet_square_footage_in_gross_absorption",
    "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.
    "sublet_square_footage_in_net_absorption",
    "total_percent_occupied", -- Percentage of the Inventory Square Footage in Mesa that is occupied.
    "sublet_percent_vacant_and_available",
    "total_available_vacant_square", -- Total square footage of all commercial property in Mesa that is vacant and also available.
    "sublet_available_vacant_square_footage",
    "direct_available_vacant_square_footage",
    "total_percent_available", -- Percentage of the Inventory Square Footage in Mesa that is available.
    "sublet_percent_available",
    "sublet_available_square_footage",
    "vacant_square_footage", -- Total square footage of all commercial property in Mesa that is vacant, or unoccupied.
    "vacancy_rate", -- Percentage of the Inventory Square Footage in Mesa that is vacant.
    "sublet_vacant_square_footage",
    "building_inventory", -- Total number of existing commercial buildings in Mesa.
    "quarter_date", -- The 3-month period, or quarter, that the data pertains to in date format.
    "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).
    "direct_square_footage_in_net_absorption",
    "direct_percent_vacant_and_available",
    "direct_vacancy_rate",
    "building_inventory_square", -- Total square footage of all existing commercial property present in Mesa.
    "nnn_rent_sublet",
    "total_square_footage_occupied", -- The amount of commercial property square footage in Mesa that is currently occupied.
    "average_base_rent_for_sublet_office_space",
    "nnn_rent_direct",
    "average_direct_gross_rent_for_office_space",
    "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.
    "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_number_of_leasing", -- The number of new leases that occurred in the given time period for all retail space.
    "direct_available_square_footage",
    "direct_percent_available",
    "total_percent_vacant_and", -- Percentage of the Inventory Square Footage in Mesa that is vacant and available.
    "all_service_type_rent_sublet",
    "average_sublet_gross_rent_for_office_space",
    "total_square_footage_of", -- The total amount of square footage absorbed in the Leasing Activity Deals Total.
    "direct_number_of_leasing_activity_deals",
    "calendar_year", -- The year that the data pertains to.
    "property_type", -- The property category type including  Office, Retail, Flex and Industrial, and All Properties.
    "location", -- Indicates if the row is part of the Downtown area or not.
    "calendar_year_and_quarter", -- The 3-month period, or quarter, that the data pertains to.
    "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).
    "total_square_footage_under", -- The total amount of square footage that is currently under construction in a given period of time.
    "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_number_of_leasing_activity_deals",
    "direct_square_footage_in_gross_absorption",
    "direct_square_footage_of_leasing_activity",
    "all_service_type_rent_direct"
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.

This repository is an "external" repository. That means it's hosted elsewhere, in this case at citydata.mesaaz.gov. When you querycitydata-mesaaz-gov/commercial-vacancy-all-properties-73s5-mf6u: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)"
 

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 (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 citydata.mesaaz.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 \
  "citydata-mesaaz-gov/commercial-vacancy-all-properties-73s5-mf6u" \
  --handler-options '{
    "domain": "citydata.mesaaz.gov",
    "tables": {
        "commercial_vacancy_all_properties": "73s5-mf6u"
    }
}'

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, citydata-mesaaz-gov/commercial-vacancy-all-properties-73s5-mf6u is just another Postgres schema.