cthru-data-socrata/budgetactualwithotherspendingauthorizationv3-fmz7-6ft9
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 budgetactualwithotherspendingauthorizationv3 table in this repository, by referencing it like:

"cthru-data-socrata/budgetactualwithotherspendingauthorizationv3-fmz7-6ft9:latest"."budgetactualwithotherspendingauthorizationv3"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "balance_forward_prior", -- Balance Forward/Prior Appropriation Continued (PAC). If authorized by the Legislature, appropriation accounts may carry forward unexpended balances into the following fiscal year. This “Prior Appropriation Continued” amount is reflected in the state accounting system as a “Balance Forward” in the current fiscal year and an equal “Beginning Balance” in the following fiscal year.
    "fund_number", -- Funds are fiscal and accounting entities, almost always established in general law, used to deposit revenues that are dedicated to specific purposes and finance expenditures for those purposes. For instance, income tax revenue is deposited in the Commonwealth’s General Fund to finance general government expenditures, while motor fuel tax collections and vehicle registration fees are deposited in the Commonwealth Transportation Fund, and are used to fund transportation-related spending, including the Massachusetts Department of Transportation (MassDOT) and Commonwealth debt service on bonds used to finance road and bridge construction. Each fund is designated in the state accounting system with a four-digit code. For example, the General Fund is designated with the digits 0010 and the Commonwealth Transportation Fund is designated with the digits 0103. The funds included in this section of CTHRU are only those subject to the Commonwealth’s annual appropriations process (“Budgeted Funds”). 
    "beginning_balance_prior", -- If authorized by the Legislature, spending accounts may carry forward unexpended balances from the prior fiscal year. The balances are reflected in the state accounting system as a “Beginning Balance” or a “Prior Appropriation Continued”. These amounts are identical to the “Balance Forward” in prior fiscal year for the same account.
    "authorized_retained_revenue_1", -- Language in a GAA or supplemental budget bill may authorize an account to retain and spend revenues generated from specified sources, such as fees, fines, or assessments. When this is the case, an account is said to have a “retained revenue” authorization, and the “ceiling” in such an account is the maximum amount of revenue that can be retained and expended during the fiscal year. Any amount of revenue collected in excess of the ceiling is deposited in one of the Commonwealth’s funds (most often the General Fund), and available for general government use.
    "unexpended_reverted", -- Represents the amount of “Total Available for Spending” that is unspent at the end of the fiscal year, reduced by the “Balance Forward” or “Prior Appropriation Continued”, into the subsequent fiscal year. This unspent amount is also known as the “reverted” amount.
    "appropriation_account_number", -- A unique eight-digit number, as identified in the General Appropriation Act (GAA) or subsequent budget bills, or established administratively, with the legislative authorization for a department to spend funds to fulfill the department’s legislative mission, including specifically identified purposes.
    "total_enacted_budget", -- The amount of spending authorizations in the GAA and any subsequent supplemental budget acts.
    "total_available_for_spending", -- The amount available in an account for expenditure in the fiscal year. Equal to Total Enacted Budget Appropriation + Retained Revenue Collected + Other Spending Authorization minus Planned Savings (9C Spending Cuts).
    "retained_revenue_collected", -- The amount of revenue actually collected in a fiscal year in an account authorized to retain revenue, up to, but not exceeding, the ceiling in that account. 
    "other_statutorily_authorized", -- Most spending is authorized by specified appropriation/account number in the GAA or supplemental budgets. However, there are cases where budgetary spending is authorized either in general law or “outside sections” of budget bills. Examples of this spending include the Commonwealth’s annual pension contribution, which is authorized by Section 22C of Chapter 32 of the Massachusetts General Laws, transfers of capital gains tax revenues to the state pension and retiree health insurance benefits funds (authorized by Section 5G of Chapter 29), and certain end of year transfers from the Commonwealth’s budget surpluses.
    "authorized_retained_revenue", -- Language in the GAA or supplemental budget bill may authorize that for a retained revenue account, an amount of specified revenue collections up to a certain level (or “floor”) may not be retained and expended in an account, but shall be deposited in a Commonwealth fund for unrestricted use. Any amount above that “floor” and up to a specified “ceiling” may be retained and expended in that account.
    "transfer_out", -- See definition for “Transfer In”.
    "transfer_in", --  A department may contract with other state departments to administer spending authorized for a particular account, or else transfer reserve funds to other accounts (for example, when central reserves are established to fund collective bargaining agreements).  When such transactions occur, funds are shown as a “transfer in” to the receiving department, and a “transfer out” from the sending department.
    "supplemental_budget", -- Subsequent to the enactment of the GAA, “supplemental budgets” may be enacted to the extent that some accounts need additional spending authorization during a fiscal year, or new accounts need to be created to fund programs or purposes that were not contemplated when the GAA was signed.
    "appropriation_account_name", -- The name of an account corresponding to an eight-digit appropriation/account number.
    "planned_savings_9c_spending", -- The Governor, under Section 9C of Chapter 29, is authorized to reduce spending authority in certain accounts in the event of a declared revenue shortfall. When such action is taken, these reductions are shown as Planned Savings (9C Spending Cuts) in these accounts. These Planned Savings reduce the Total Available for Spending
    "department_name", -- A Department is an entity of state government with a specific mission, established by the legislature, which may either report to cabinet-level units of government, known as executive offices or secretariats, or be independent divisions or departments.  Each department has an assigned three-letter code in the accounting system; for example, the Office of the Comptroller is CTR.
    "total_expenses", -- The total amount expended in the fiscal year; for the current active fiscal year (but not for closed fiscal years), this includes the amount of expenses accrued but not yet paid out as cash to vendors. This gap may occur because there is often a grace period (of up to 45 days) between when an expense is incurred (e.g., when it is billed) and when the payment is made to the vendor.
    "department_code", -- A Department is an entity of state government with a specific mission, established by the legislature, which may either report to cabinet-level units of government, known as executive offices or secretariats, or be independent divisions or departments.  Each department has an assigned three-letter code in the accounting system; for example, the Office of the Comptroller is CTR.
    "fund_name",
    "original_enacted_budget", -- The Original Enacted Budget is the amount of spending authorized for each appropriation or account in the annual budget bill, or GAA, which is enacted and signed into law prior to or just after the start of each fiscal year.
    "fiscal_year", -- The period during which a fiscal year's budget may be expended.  This period for any fiscal year is from July 1st of the preceding calendar year through June 30th of the current calendar year. It is the period within which all goods and/or services must be received to be payable with those fiscal year funds.  For example, fiscal year 2018 began on July 1, 2017 and ended on June 30, 2018.
    "retained_revenue_estimate" -- The amount of revenue estimated to be collected during a fiscal year in an account authorized to retain and spend such revenue.
FROM
    "cthru-data-socrata/budgetactualwithotherspendingauthorizationv3-fmz7-6ft9:latest"."budgetactualwithotherspendingauthorizationv3"
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 cthru-data-socrata/budgetactualwithotherspendingauthorizationv3-fmz7-6ft9 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 cthru-data-socrata/budgetactualwithotherspendingauthorizationv3-fmz7-6ft9: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 cthru-data-socrata/budgetactualwithotherspendingauthorizationv3-fmz7-6ft9

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 cthru-data-socrata/budgetactualwithotherspendingauthorizationv3-fmz7-6ft9:latest

This will download all the objects for the latest tag of cthru-data-socrata/budgetactualwithotherspendingauthorizationv3-fmz7-6ft9 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 cthru-data-socrata/budgetactualwithotherspendingauthorizationv3-fmz7-6ft9: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 cthru-data-socrata/budgetactualwithotherspendingauthorizationv3-fmz7-6ft9: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, cthru-data-socrata/budgetactualwithotherspendingauthorizationv3-fmz7-6ft9 is just another Postgres schema.

Related Documentation:

Loading...