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

"ny-gov/summary-financial-information-for-local-cgg6-2ah8:latest"."summary_financial_information_for_local"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "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. 
    "net_assets_deficit_at_end_of_year", -- Net assets (deficit) beginning of year plus the change in net assets  and other net assets changes. 
    "other_net_assets_changes", -- Changes in net assets that are not reflected in the categories  provided. 
    "net_assets_deficit_beginning_of_year", -- Net assets at the beginning of the year (this amount is carried  forward from the prior reporting period). 
    "change_in_net_assets", -- Income (Loss) Before Contributions plus Capital Contributions 
    "capital_contributions", -- Grants or outside contributions of resources restricted to capital  acquisition or construction. 
    "income_loss_before_contributions", -- Operating Income (loss) plus total non-operating revenue minus  total non-operating expenses. 
    "total_nonoperating_expenses", -- Sum of interest and other financing charges, subsidies to other  public authorities, grants and donations, and other non-operating  expenses.
    "other_nonoperating_expenses", -- Other miscellaneous non-operating expenditures incurred by the  authority that are not reflected in the categories provided are to be  included here. 
    "grants_and_donations", -- These consist of assistance awards paid by the authority to another  entity such as a municipality for a specific program purpose. 
    "subsidies_to_other_public_authorities", -- Contributions made to other public authorities in the form of a grant  or transfer of funds. 
    "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. 
    "total_nonoperating_revenue", -- Sum of investment earnings, state subsidies/grants, federal  subsidies/grants, municipal subsidies/grant, public authority  subsidies, and other non-operating revenues. 
    "other_nonoperating_revenues", -- Any other non-operating revenues recognized by the authority that  are not reflected in the categories provided. 
    "public_authority_subsidies", -- Revenue received from another public authority in the form of a subsidy or grant. 
    "municipal_subsidies_grants", -- Funds provided to the authority by a Municipal grant or subsidy. 
    "federal_subsidies_grants", -- Funds provided to the authority by a Federal grant or subsidy. 
    "state_subsidies_grants", -- These include State contributions received in the form of funds  provided to the authority by a State grant or subsidy. 
    "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. 
    "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. 
    "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. 
    "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. 
    "total_liabilities", -- Sum of total current liabilities and total noncurrent liabilities 
    "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_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. 
    "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", -- This consists of that portion of required post-employment benefits  to be paid by the authority that is not due to be paid within one  year. 
    "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. 
    "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", -- 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. 
    "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. 
    "accrued_liabilities", -- 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.
    "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. 
    "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. 
    "authority_name", -- Name of the Public Authority. 
    "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. 
    "fiscal_year_end_date", -- Date of Fiscal Year end for the Authority
    "cash_and_cash_equivalents", -- Date of Fiscal Year end for the Authority
    "investments", -- These are securities or other assets that are purchased with the  expectation of realizing income or profit. 
    "total_assets", -- Sum of total current assets and total noncurrent assets .
    "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_noncurrent_assets", -- Sum of restricted cash and investments, net long term receivables,  other noncurrent assets, and net capital assets.
    "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. 
    "net_capital_assets", -- Sum of land and other non-depreciable property, buildings and  equipment, and infrastructure minus accumulated depreciation. 
    "land_and_other_nondepreciable_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. 
    "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. 
    "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. 
FROM
    "ny-gov/summary-financial-information-for-local-cgg6-2ah8: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-cgg6-2ah8 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 ny-gov/summary-financial-information-for-local-cgg6-2ah8: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 ny-gov/summary-financial-information-for-local-cgg6-2ah8

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 ny-gov/summary-financial-information-for-local-cgg6-2ah8:latest

This will download all the objects for the latest tag of ny-gov/summary-financial-information-for-local-cgg6-2ah8 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 ny-gov/summary-financial-information-for-local-cgg6-2ah8: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 ny-gov/summary-financial-information-for-local-cgg6-2ah8: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, ny-gov/summary-financial-information-for-local-cgg6-2ah8 is just another Postgres schema.

Related Documentation:

Loading...