ny-gov/summary-financial-information-for-local-wgry-y5zd
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 summary_financial_information_for_local table in this repository, by referencing it like:

"ny-gov/summary-financial-information-for-local-wgry-y5zd:latest"."summary_financial_information_for_local"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "municipal_subsidies_grants", -- Funds provided to the authority by a Municipal grant or subsidy.
    "public_authority_subsidies", -- Revenue received from another public authority in the form of a subsidy or grant.
    "other_non_operating_revenues", -- Any other non-operating revenues recognized by the authority that are not reflected in the categories provided.
    "total_non_operating_revenue", -- Sum of investment earnings, state subsidies/grants, federal subsidies/grants, municipal subsidies/grant, public authority subsidies, and other non-operating revenues.
    "pension_contribution_payable_noncurrent", -- This consists of the portion of the authority’s pension contribution payments that are not due to be paid within one year.
    "total_current_liabilities", -- Sum of accounts payable, current pension contribution payable, current OPEB, accrued liabilities, deferred revenues, current bonds and notes payable, and other long-term obligation due within one year.
    "other_long_term_obligations_due_within_one_year", -- This consists of liabilities that are not reflected in the categories provided, such as obligations for long term leases.
    "bonds_and_notes_payable_current", -- These are short-term obligations that are payable in one year, or less. These generally include the portion of the authority’s longterm debt that is due for payment during the next year.
    "interest_and_other_financing_charges", -- Interest payments on loans and other obligations of the authority. This category includes expenses for issuing debt, such as fees for underwriters and bond counsel.
    "other_net_assets_changes", -- Changes in net assets that are not reflected in the categories provided.
    "net_assets_deficit_at_end_of_year", -- Net assets (deficit) beginning of year plus the change in net assets and other net assets changes.
    "total_assets", -- Sum of total current assets and total noncurrent assets.
    "total_noncurrent_assets", -- Sum of restricted cash and investments, net long term receivables, other noncurrent assets, and net capital assets.
    "income_loss_before_contributions", -- Operating Income (loss) plus total non-operating revenue minus total non-operating expenses
    "long_term_leases", -- These consist of the non-current portion of any long term leases entered by the authority.
    "bonds_and_notes_payable_noncurrent", -- These consist of the authority’s long-term outstanding bank loans and other long-term borrowings from financial institutions or commercial paper that are not due to be paid within one year.
    "other_post_employment_benefits_noncurrent", -- Other Post-Employment Benefits (OPEB) refers to benefits other than pension benefits. OPEB consists primarily of health care benefits, but may also include other benefits such as life insurance, or other types of compensation provided after an employee leaves the authority’s service. This category consists of that portion of required post-employment benefits to be paid by the authority that will be paid within the next year.
    "accumulated_depreciation", -- Depreciation expense represents the allocation of the depreciable cost of a capital asset over its lifetime, charging a share of its cost into each year that the asset is used by the authority. Accumulated depreciation is therefore the total amount of depreciation related to a fixed asset that has been added up over the years the organization has owned the asset; it represents the total costs associated with the wear and tear or obsolescence of the fixed asset to date.
    "investment_earnings", -- All income earned by the authority through investment activities. This includes interest earned from investments and bank accounts, among other sources.
    "operating_income_loss", -- Total operating revenue minus total operating expenses.
    "capital_contributions", -- Grants or outside contributions of resources restricted to capital acquisition or construction.
    "total_operating_expenses", -- Sum of salaries and wages, other employee benefits, professional service contracts, supplies and materials, depreciation and amortization, and other operating expenses.
    "other_operating_expenses", -- These can include other costs incurred by the authority while carrying out its mission such as fixed charges. Fixed charges are periodic in nature and do not vary with the authority’s business volume. Items such as gas and electric, administrative costs, costs for rent or mortgage payments can be included here.
    "depreciation_and_amortization", -- Depreciation and amortization represent the allocation of the cost of a long-term asset to an expense over the useful life of the asset. Depreciation expense is for tangible assets while amortization expense is for intangible assets.
    "supplies_and_materials", -- Payments for items that are used as part of the authority’s normal operations. This does not include (a) goods that have been acquired for use in constructing real property, (b) stockpile materials, and (c) inventory.
    "professional_services_contracts", -- Payments for work performed by an independent contractor or consultant requiring specialized knowledge, experience, expertise or similar capabilities. Common examples of contractual services are auditing and accounting services, legal services, or advertising and marketing services.
    "other_employee_benefits", -- Compensation due to an employee pursuant to a written contract or written policy for holiday, time off for sickness, injury, personal reasons or vacation, bonuses, authorized expenses incurred during the course of employment, and contributions made on behalf of an employee towards health insurance and premiums. This category includes fringe benefits and allowances that are payments made by the authority for housing, relocation or transportation of employees which may or may not be paid directly to the employee.
    "salaries_and_wages", -- Salaries and related payroll expenses paid to the employees of the authority.
    "total_operating_revenue", -- Sum of charges for services, rental and financing income, and other operating revenue.
    "other_operating_revenues", -- Any other operating revenues recognized by the authority that are not reflected in the categories provided.
    "rental_and_financing_income", -- This is revenue received by the authority from renting property/premises to which the authority holds the title, as well as interest received from loans and financing income.
    "net_capital_assets", -- Sum of land and other non-depreciable property, buildings and equipment, and infrastructure minus accumulated depreciation.
    "pension_contribution_payable_current", -- Pensions are a qualified retirement plan provided by the authority to allow its employees to receive post-retirement benefits, consisting of some form of compensation to be received by the employee after he/she has retired. Pension Contribution Payable is the amount owed by the authority to a pension trust fund and payable within the next year.
    "other_post_employment_benefits_current", -- Other Post-Employment Benefits (OPEB) refers to benefits other than pension benefits. OPEB consists primarily of health care benefits, but may also include other benefits such as life insurance, or other types of compensation provided after an employee leaves the authority’s service. This category consists of that portion of required post-employment benefits to be paid by the authority that will be paid within the next year.
    "charges_for_services", -- The primary revenue source generated from the services provided by the authority. This could include fees, toll collections, usage charges, etc.
    "total_net_assets", -- Sum of investment in capital assets net of related debt, restricted net assets and unrestricted net assets.
    "grants_and_donations", -- These consist of assistance awards paid by the authority to another entity such as a municipality for a specific program purpose.
    "other_long_term_obligations", -- Other long term obligations are those liabilities that are not reflected in the above categories and are not due to be paid within one year.
    "total_noncurrent_liabilities", -- Sum of noncurrent pension contribution payable, noncurrent OPEB, noncurrent bonds and notes payable, long term leases, and other long-term obligations.
    "other_non_operating_expenses", -- Other miscellaneous non-operating expenditures incurred by the authority that are not reflected in the categories provided are to be included here.
    "accrued_liabilities", -- Accrued liabilities consist of obligations for goods and services provided to the authority for which invoices have not yet been received and other accrued expenses. Examples include employee compensation earned but not yet paid or accrued rent payable. Accrued liabilities can be routine and recurring or infrequent or nonroutine.
    "total_non_operating_expenses", -- Sum of interest and other financing charges, subsidies to other public authorities, grants and donations, and other non-operating expenses.
    "subsidies_to_other_public_authorities", -- Contributions made to other public authorities in the form of a grant or transfer of funds.
    "accounts_payable", -- The amount owed to vendors for products and services purchased on credit. It is a current liability since the expectation is that the authority will fulfill this liability in less than a year.
    "unrestricted_net_assets", -- This is the portion of the Authority’s Net Assets that is not restricted for use by legal or contractual requirements and may be used for any authority purpose, operational, or otherwise.
    "restricted_net_assets", -- This is the portion of the authority’s Net Assets for which the use is subject to external restrictions imposed by creditors (such as debt covenants), grantors, contributors, or government laws or regulations.
    "invested_in_capital_assets_net_of_related_debt", -- This is the authority’s Capital Assets net of any outstanding debt for which the proceeds were invested in the capital assets. This reflects the portion of net assets that are comprised of capital assets, such as land, infrastructure, or buildings.
    "change_in_net_assets", -- Income (Loss) Before Contributions plus Capital Contributions.
    "authority_name", -- Name of the Public Authority
    "fiscal_year_end_date", -- Date of Fiscal Year end for the Authority
    "cash_and_cash_equivalents", -- Cash is defined as currency on hand and amounts that can be withdrawn from bank accounts. Cash equivalents are very shortterm investments with an original maturity of three months or less such as money market deposits or treasury bills.
    "investments", -- These are securities or other assets that are purchased with the expectation of realizing income or profit.
    "net_assets_deficit_beginning_of_year", -- Net assets at the beginning of the year (this amount is carried forward from the prior reporting period).
    "receivables_net", -- This represents interest receivable on investments, accrued subsidies and other income, and money owed to the authority by other parties for services that have been provided by the authority, and is expected to be received within the next year.
    "other_assets_current", -- All other current assets that are not represented in the above categories should be reflected here, for example, inventory.
    "total_current_assets", -- Sum of cash and cash equivalents, investments, net receivables, and other current assets.
    "restricted_cash_and_investments", -- This consists of cash and certain investments for which the use is subject to external restrictions imposed by creditors (such as debt covenants), grantors, contributors, government laws or regulations.
    "long_term_receivables_net", -- This represents the portion of net receivables not expected to be collected within one year.
    "other_assets_noncurrent", -- Other non-current assets that are not reflected in the categories provided other than Capital Assets.
    "infrastructure", -- Infrastructure assets are long-lived capital assets that normally remain stationary in nature and normally can be preserved for a significantly greater number of years than most capital assets. Examples of infrastructure assets include roads, bridges, tunnels, water and sewer systems, dams and lighting systems.
    "deferred_revenues", -- This consists of income for which cash has been collected by the authority, but it is still to be ‘earned’ in the authority’s books of accounts. For example: Assuming that an authority’s fiscal year ends on June 30th; if a customer pays the authority an annual licensing fee on January 1st, one-half of the fee would be reflected as deferred revenue, since it applies to July 1 through December 31.
    "buildings_and_equipment", -- Buildings and Equipment are depreciable capital assets having useful lives that extend beyond the year in which they are purchased. Buildings consist of properties and premises for which the authority holds legal title. Equipment consists of machines or major tools necessary for the authority to perform its operations.
    "land_and_other_non_depreciable_property", -- This includes land and land preparation costs of the authority that cannot be depreciated. Land is recorded at acquisition cost, including ancillary charges or estimated fair market value plus ancillary charges at the date of acquisition if donated.
    "total_liabilities", -- Sum of total current liabilities and total noncurrent liabilities.
    "state_subsidies_grants", -- These include State contributions received in the form of funds provided to the authority by a State grant or subsidy.
    "federal_subsidies_grants" -- Funds provided to the authority by a Federal grant or subsidy.
FROM
    "ny-gov/summary-financial-information-for-local-wgry-y5zd:latest"."summary_financial_information_for_local"
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 ny-gov/summary-financial-information-for-local-wgry-y5zd with SQL in under 60 seconds.

This repository is an "external" repository. That means it's hosted elsewhere, in this case at data.ny.gov. When you queryny-gov/summary-financial-information-for-local-wgry-y5zd: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 data.ny.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 \
  "ny-gov/summary-financial-information-for-local-wgry-y5zd" \
  --handler-options '{
    "domain": "data.ny.gov",
    "tables": {
        "summary_financial_information_for_local": "wgry-y5zd"
    }
}'

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, ny-gov/summary-financial-information-for-local-wgry-y5zd is just another Postgres schema.