datos-gov-co/menmatriculaestadisticaes-5wck-szir
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 menmatriculaestadisticaes table in this repository, by referencing it like:

"datos-gov-co/menmatriculaestadisticaes-5wck-szir:latest"."menmatriculaestadisticaes"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "departamento_de_domicilio_de_la_ies", -- Descripción del departamento de domicilio de la Institución de Educación Superior
    "c_digo_del_municipio_ies", -- Código del municipio del domicilio de la Institución de Educación Superior
    "c_digo_del_departamento_programa", -- Código del departamento del domicilio del programa de Educación Superior
    "c_digo_del_departamento_ies", -- Código del departamento del domicilio de la Institución de Educación Superior
    "a_o", -- Corresponde al año de reporte de la variable poblacional a un programa de educación superior.
    "n_cleo_b_sico_del_conocimiento_nbc", -- Las áreas de conocimiento se organizan a su vez en NÚCLEOS BÁSICOS del conocimiento o clasificaciones de un área del conocimiento en sus campos, disciplinas o profesiones esenciales.
    "id_nucleo", -- Código del Núcleo de conocimiento
    "id_area", -- Agrupación que se hace de los programas académicos, teniendo en cuenta cierta afinidad en los contenidos, en los campos específicos del conocimiento, en los campos de acción de la educación superior cuyos propósitos de formación conduzcan a la investigación o al desempeño de ocupaciones, profesiones y disciplinas.
    "id_nivel_formacion", -- Etapas de los niveles académicos del sistema de educación superior. 
    "c_digo_de_la_instituci_n", -- Código de la Institución de Educación Superior 
    "c_digo_snies_delprograma", -- Código SNIES asignado al programa académico
    "id_metodologia", -- Forma de enseñanza, los programas académicos  ofrecidos
    "municipio_dedomicilio_de_la_ies", -- Descripción del municipio de domicilio de la Institución de Educación Superior
    "ies_padre", -- Código de la IES que agrupa sus seccionales 
    "id_nivel", -- Nivel Académico del programa (pregrado o posgrado)
    "semestre", -- Semestre de reporte de la variable poblacional a un programa de educación superior
    "id_caracter", -- Naturaleza o vocación en el quehacer académico de una institución de educación superior.
    "programa_acad_mico", -- Nombre del Programa Académico
    "principal_oseccional", -- Identifica si el programa académico se ofrece en una seccional o sede  principal
    "id_sector", -- Identifica el sector de la Institución, público o privado
    "instituci_n_de_educaci_n_superior_ies", -- Nombre de la Institución de Educación Superior (IES)
    "municipio_de_oferta_del_programa", -- Descripción del municipio de domicilio del programa de Educación Superior
    "matriculados_2015", -- Numero total de estudiantes matriculados
    "id_g_nero", -- Código de la característica natural biológica de nacimiento del estudiante reportado a la variable poblacional como aparece registrado en el documento de identidad. (1 Masculino - Hombre, 2 Femenino - Mujer)
    "departamento_de_oferta_del_programa", -- Descripción del departamento de domicilio del programa de Educación Superior
    "c_digo_del_municipio_programa" -- Código del municipio del domicilio del programa de Educación Superior
FROM
    "datos-gov-co/menmatriculaestadisticaes-5wck-szir:latest"."menmatriculaestadisticaes"
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 datos-gov-co/menmatriculaestadisticaes-5wck-szir with SQL in under 60 seconds.

This repository is an "external" repository. That means it's hosted elsewhere, in this case at www.datos.gov.co. When you querydatos-gov-co/menmatriculaestadisticaes-5wck-szir: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 www.datos.gov.co, 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 \
  "datos-gov-co/menmatriculaestadisticaes-5wck-szir" \
  --handler-options '{
    "domain": "www.datos.gov.co",
    "tables": {
        "menmatriculaestadisticaes": "5wck-szir"
    }
}'

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, datos-gov-co/menmatriculaestadisticaes-5wck-szir is just another Postgres schema.