ny-gov/corporations-and-other-entities-all-filings-63wc-4exh
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 corporations_and_other_entities_all_filings table in this repository, by referencing it like:

"ny-gov/corporations-and-other-entities-all-filings-63wc-4exh:latest"."corporations_and_other_entities_all_filings"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "film_num", -- Unique ID Number for each document filed
    "juris", -- State or country of formation
    "amd_chair_flag", -- 'X' indicates the addition or amendment to the Name and/or business address of the Chief Executive Office 
    "law", -- The law under which the document was filed
    "amd_for_juris_flag", -- ‘X' indicates a change to the foreign entity’s jurisdiction of formation
    "amd_corp_name_flag", -- 'X' indicates a change in the Entity Name
    "dead_file_flag", -- Indicates the Corporations and Other Business Entity Database does not include the entire filing record history for the entity.  'F' means the document is the first record in the filing history and that other prior document(s) are not on file with DOS.  'D' means that only part of the filing history is in the Database and that the DOS Card Index includes information on other documents filed with DOS
    "amd_stock_flag", -- 'X' indicates a change in the Share information
    "amd_admit_prtnr_flag", -- 'X' indicates the addition of a general partner to a limited partnership
    "amd_prov_flag", -- 'X' indicates a change to a provision in the document indicated. This is a catch-all for amendments or changes not covered by other amendment flags
    "admin_name_flag", -- 'X' indicated that during a previous data conversion this filing has the correct name of the entity.  This flag does not affect the current name of the entity.
    "amd_purps_flag", -- 'X' indicates an amendment to the Purpose of an entity
    "amd_cnty_flag", -- 'X' indicates a change in County.
    "amd_withdr_prtnr_flag", -- 'X' indicates the withdraw of a general partner from a limited partnership
    "restate_cert_flag", -- 'X' indicates the filing is a Restated Certificate of Incorporation
    "constituent_flag", -- A 'C' indicates that the entity is a constituent of a merger or consolidation and that additional information for the constituent is not in the Database, is not available, or is maintained in the DOS Card File
    "dis_eff_date", -- Date on which a dissolution becomes effective
    "amd_for_inc_date_flag", -- 'X' indicates a change to the formation date of a foreign entity.  This is the date when a foreign entity was formed in the jurisdiction of its formation  
    "fict_name", -- Fictitious name of foreign entity, if any
    "amd_loc_flag", -- 'X' indicates change to the Business Corporation’s principal executive office
    "mod_certcode", -- The mod cert code, taken together with the information in the LAW field, is a description of the type of document represented by this record
    "amd_nfp_type_flag", -- 'X' indicates a change to the Not-For-Profit Corporation category
    "corp_name", -- True/Real name of an entity
    "eff_date", -- Effective Date of the document filed 
    "nfp_type", -- Category (“Charitable” or “Non-Charitable”) of the Not-for-Profit Corporation
    "for_inc_date", -- Date on which a foreign entity was formed in the jurisdiction of its formation
    "approved_date", -- Date the document was approved by the Department of State for filing
    "corpid_num", -- DOS Unique ID number for each entity
    "amd_reg_agt_flag", -- 'X' indicates a change in the Registered Agent’s address
    "amd_fict_name_flag", -- Fictitious name indicator for the filing.  '1' means maintain the fictitious name, '2' means the fictitious name was amended or changed, '3' means the fictitious name is being dropped or deactivated, '4' means a fictitious name was added to the entity
    "amd_dura_flag", -- 'X' indicates a change in Corporation’s duration date or the latest date of dissolution for a Limited Liability Company or Limited Partnership 
    "cnty_prin_ofc", -- County in which the office or principal office of the entity is to be located
    "amd_procs_info_flag", -- 'X' indicates a change to the Service of Process address
    "documenttype", -- Type of document filed (e.g., “certificate of incorporation”)
    "dura_date", -- The date on which a corporation is dissolved by expiration of its period of duration or the date after which the Limited Liability Company or Limited Partnership is to dissolve
    "date_filed", -- The date the document was filed by Department of State
    "entitytype" -- Type of entity (e.g., “business corporation”)
FROM
    "ny-gov/corporations-and-other-entities-all-filings-63wc-4exh:latest"."corporations_and_other_entities_all_filings"
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/corporations-and-other-entities-all-filings-63wc-4exh 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/corporations-and-other-entities-all-filings-63wc-4exh: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/corporations-and-other-entities-all-filings-63wc-4exh" \
  --handler-options '{
    "domain": "data.ny.gov",
    "tables": {
        "corporations_and_other_entities_all_filings": "63wc-4exh"
    }
}'

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/corporations-and-other-entities-all-filings-63wc-4exh is just another Postgres schema.