ny-gov/corporations-and-other-entities-all-filings-63wc-4exh
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 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
    "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
    "entitytype", -- Type of entity (e.g., “business corporation”)
    "cnty_prin_ofc", -- County in which the office or principal office of the entity is to be located
    "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 
    "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_withdr_prtnr_flag", -- 'X' indicates the withdraw of a general partner from a limited partnership
    "amd_loc_flag", -- 'X' indicates change to the Business Corporation’s principal executive office
    "amd_procs_info_flag", -- 'X' indicates a change to the Service of Process address
    "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.
    "juris", -- State or country of formation
    "fict_name", -- Fictitious name of foreign entity, if any
    "corpid_num", -- DOS Unique ID number for each entity
    "approved_date", -- Date the document was approved by the Department of State for filing
    "for_inc_date", -- Date on which a foreign entity was formed in the jurisdiction of its formation
    "nfp_type", -- Category (“Charitable” or “Non-Charitable”) of the Not-for-Profit Corporation
    "eff_date", -- Effective Date of the document filed 
    "corp_name", -- True/Real name of an entity
    "dis_eff_date", -- Date on which a dissolution becomes effective
    "film_num", -- Unique ID Number for each document filed
    "amd_chair_flag", -- 'X' indicates the addition or amendment to the Name and/or business address of the Chief Executive Office 
    "amd_stock_flag", -- 'X' indicates a change in the Share information
    "law", -- The law under which the document was filed
    "documenttype", -- Type of document filed (e.g., “certificate of incorporation”)
    "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
    "date_filed", -- The date the document was filed by Department of State
    "amd_purps_flag", -- 'X' indicates an amendment to the Purpose of an entity
    "amd_for_juris_flag", -- ‘X' indicates a change to the foreign entity’s jurisdiction of formation
    "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
    "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
    "amd_nfp_type_flag", -- 'X' indicates a change to the Not-For-Profit Corporation category
    "amd_corp_name_flag", -- 'X' indicates a change in the Entity Name
    "amd_cnty_flag", -- 'X' indicates a change in County.
    "amd_admit_prtnr_flag", -- 'X' indicates the addition of a general partner to a limited partnership
    "amd_reg_agt_flag", -- 'X' indicates a change in the Registered Agent’s address
    "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
    "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  
    "restate_cert_flag" -- 'X' indicates the filing is a Restated Certificate of Incorporation
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.

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/corporations-and-other-entities-all-filings-63wc-4exh: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/corporations-and-other-entities-all-filings-63wc-4exh

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/corporations-and-other-entities-all-filings-63wc-4exh:latest

This will download all the objects for the latest tag of ny-gov/corporations-and-other-entities-all-filings-63wc-4exh 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/corporations-and-other-entities-all-filings-63wc-4exh: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/corporations-and-other-entities-all-filings-63wc-4exh: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/corporations-and-other-entities-all-filings-63wc-4exh is just another Postgres schema.

Related Documentation:

Loading...