{"id":19758839,"url":"https://github.com/daq-tools/skeem","last_synced_at":"2025-04-30T12:32:21.669Z","repository":{"id":71969840,"uuid":"592952725","full_name":"daq-tools/skeem","owner":"daq-tools","description":"Infer SQL DDL statements from tabular data.","archived":false,"fork":false,"pushed_at":"2025-03-31T16:25:33.000Z","size":266,"stargazers_count":3,"open_issues_count":9,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T01:51:12.330Z","etag":null,"topics":["data-import","data-importing","data-ingest","data-ingestion","database","ddl","ddl-export","introspection","rdbms","rdbms-import","rdbms-support","reflection","schema","schema-conversion","sql","sql-database","sql-databases","sql-schema","sql-tools","tabular-data"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daq-tools.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-24T22:07:01.000Z","updated_at":"2025-02-20T03:13:26.000Z","dependencies_parsed_at":"2023-10-03T08:14:45.101Z","dependency_job_id":"2cd572fa-3d97-4dc6-ad1d-037e148573a5","html_url":"https://github.com/daq-tools/skeem","commit_stats":{"total_commits":163,"total_committers":2,"mean_commits":81.5,"dds":"0.32515337423312884","last_synced_commit":"392f78879e74a6d3d129b9b265995d0bf743c37e"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daq-tools%2Fskeem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daq-tools%2Fskeem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daq-tools%2Fskeem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daq-tools%2Fskeem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daq-tools","download_url":"https://codeload.github.com/daq-tools/skeem/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251701786,"owners_count":21629896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-import","data-importing","data-ingest","data-ingestion","database","ddl","ddl-export","introspection","rdbms","rdbms-import","rdbms-support","reflection","schema","schema-conversion","sql","sql-database","sql-databases","sql-schema","sql-tools","tabular-data"],"created_at":"2024-11-12T03:26:11.471Z","updated_at":"2025-04-30T12:32:21.240Z","avatar_url":"https://github.com/daq-tools.png","language":"Python","readme":"#####\nSkeem\n#####\n\n|\n\n.. start-badges\n\n|ci-tests| |ci-coverage| |license| |pypi-downloads|\n|python-versions| |status| |pypi-version|\n\n.. |ci-tests| image:: https://github.com/daq-tools/skeem/actions/workflows/tests.yml/badge.svg\n    :target: https://github.com/daq-tools/skeem/actions/workflows/tests.yml\n\n.. |ci-coverage| image:: https://codecov.io/gh/daq-tools/skeem/branch/main/graph/badge.svg\n    :target: https://codecov.io/gh/daq-tools/skeem\n    :alt: Test suite code coverage\n\n.. |python-versions| image:: https://img.shields.io/pypi/pyversions/skeem.svg\n    :target: https://pypi.org/project/skeem/\n\n.. |status| image:: https://img.shields.io/pypi/status/skeem.svg\n    :target: https://pypi.org/project/skeem/\n\n.. |pypi-version| image:: https://img.shields.io/pypi/v/skeem.svg\n    :target: https://pypi.org/project/skeem/\n\n.. |pypi-downloads| image:: https://static.pepy.tech/badge/skeem/month\n    :target: https://pypi.org/project/skeem/\n\n.. |license| image:: https://img.shields.io/pypi/l/skeem.svg\n    :target: https://github.com/daq-tools/skeem/blob/main/LICENSE\n\n.. end-badges\n\n\n*****\nAbout\n*****\n\nSkeem infers SQL DDL statements from tabular data.\n\nSkeem is, amongst others, based on the excellent `ddlgenerator`_,\n`frictionless`_, `fsspec`_, `pandas`_, `ScipPy`_, `SQLAlchemy`_\nand `xarray`_ packages, and can be used both as a standalone program,\nand as a library.\n\nSupported input data:\n\n- `Apache Parquet`_\n- `CSV`_\n- `Google Sheets`_\n- `GRIB`_\n- `InfluxDB line protocol`_\n- `JSON`_\n- `NetCDF`_\n- `NDJSON`_ (formerly LDJSON) aka. `JSON Lines`_, see also `JSON streaming`_\n- `Office Open XML Workbook`_ (`Microsoft Excel`_)\n- `OpenDocument Spreadsheet`_ (`LibreOffice`_)\n\nSupported input sources:\n\n- `Amazon S3`_\n- `File system`_\n- `GitHub`_\n- `Google Cloud Storage`_\n- `HTTP`_\n\nPlease note that Skeem is beta-quality software, and a work in progress.\nContributions of all kinds are very welcome, in order to make it more solid.\nBreaking changes should be expected until a 1.0 release, so version pinning\nis recommended, especially when you use it as a library.\n\n\n********\nSynopsis\n********\n\n.. code-block:: sh\n\n    skeem infer-ddl --dialect=postgresql data.ndjson\n\n.. code-block:: sql\n\n    CREATE TABLE \"data\" (\n        \"id\" SERIAL NOT NULL,\n        \"name\" TEXT NOT NULL,\n        \"date\" TIMESTAMP WITHOUT TIME ZONE,\n        \"fruits\" TEXT NOT NULL,\n        \"price\" DECIMAL(2, 2) NOT NULL,\n        PRIMARY KEY (\"id\")\n    );\n\n\n**********\nQuickstart\n**********\n\nIf you are in a hurry, and want to run Skeem without any installation, just use\nthe OCI image on Podman or Docker.\n\n.. code-block:: sh\n\n    docker run --rm ghcr.io/daq-tools/skeem-standard \\\n        skeem infer-ddl --dialect=postgresql \\\n        https://github.com/daq-tools/skeem/raw/main/tests/testdata/basic.ndjson\n\n\n*****\nSetup\n*****\n\nInstall Skeem from PyPI.\n\n.. code-block:: sh\n\n    pip install skeem\n\nInstall Skeem with support for additional data formats like NetCDF.\n\n.. code-block:: sh\n\n    pip install 'skeem[scientific]'\n\n\n*****\nUsage\n*****\n\nThis section outlines some example invocations of Skeem, both on the command\nline, and per library use. Other than the resources available from the web,\ntesting data can be acquired from the repository's `testdata`_ folder.\n\nCommand line use\n================\n\nHelp\n----\n\n.. code-block:: sh\n\n    skeem info\n    skeem --help\n    skeem infer-ddl --help\n\nRead from files\n---------------\n\n.. code-block:: sh\n\n    # NDJSON, Parquet, and InfluxDB line protocol (ILP) formats.\n    skeem infer-ddl --dialect=postgresql data.ndjson\n    skeem infer-ddl --dialect=postgresql data.parquet\n    skeem infer-ddl --dialect=postgresql data.lp\n\n    # CSV, JSON, ODS, and XLSX formats.\n    skeem infer-ddl --dialect=postgresql data.csv\n    skeem infer-ddl --dialect=postgresql data.json\n    skeem infer-ddl --dialect=postgresql data.ods\n    skeem infer-ddl --dialect=postgresql data.xlsx\n    skeem infer-ddl --dialect=postgresql data.xlsx --address=\"Sheet2\"\n\nRead from URLs\n--------------\n\n.. code-block:: sh\n\n    # CSV, NDJSON, XLSX\n    skeem infer-ddl --dialect=postgresql https://github.com/daq-tools/skeem/raw/main/tests/testdata/basic.csv\n    skeem infer-ddl --dialect=postgresql https://github.com/daq-tools/skeem/raw/main/tests/testdata/basic.ndjson\n    skeem infer-ddl --dialect=postgresql https://github.com/daq-tools/skeem/raw/main/tests/testdata/basic.xlsx --address=\"Sheet2\"\n\n    # Google Sheets: Address first sheet, and specific sheet of workbook.\n    skeem infer-ddl --dialect=postgresql --table-name=foo https://docs.google.com/spreadsheets/d/1ExyrawjlyksbC6DOM6nLolJDbU8qiRrrhxSuxf5ScB0/view\n    skeem infer-ddl --dialect=postgresql --table-name=foo https://docs.google.com/spreadsheets/d/1ExyrawjlyksbC6DOM6nLolJDbU8qiRrrhxSuxf5ScB0/view#gid=883324548\n\n    # InfluxDB line protocol (ILP)\n    skeem infer-ddl --dialect=postgresql https://github.com/influxdata/influxdb2-sample-data/raw/master/air-sensor-data/air-sensor-data.lp\n\n    # Compressed files in gzip format\n    skeem --verbose infer-ddl --dialect=crate --content-type=ndjson https://s3.amazonaws.com/crate.sampledata/nyc.yellowcab/yc.2019.07.gz\n\n    # CSV on S3\n    skeem --verbose infer-ddl --dialect=postgresql s3://noaa-ghcn-pds/csv/by_year/2022.csv\n\n    # CSV on Google Cloud Storage\n    skeem --verbose infer-ddl --dialect=postgresql gs://tinybird-assets/datasets/nations.csv\n    skeem --verbose infer-ddl --dialect=postgresql gs://tinybird-assets/datasets/medals1.csv\n\n    # CSV on GitHub\n    skeem --verbose infer-ddl --dialect=postgresql github://daq-tools:skeem@/tests/testdata/basic.csv\n\n    # GRIB2, NetCDF\n    skeem infer-ddl --dialect=postgresql https://github.com/earthobservations/testdata/raw/main/opendata.dwd.de/weather/nwp/icon/grib/18/t/icon-global_regular-lat-lon_air-temperature_level-90.grib2\n    skeem infer-ddl --dialect=postgresql https://www.unidata.ucar.edu/software/netcdf/examples/sresa1b_ncar_ccsm3-example.nc\n    skeem infer-ddl --dialect=postgresql https://www.unidata.ucar.edu/software/netcdf/examples/WMI_Lear.nc\n\nOCI\n---\n\nOCI images are available on the GitHub Container Registry (GHCR). In order to\nrun them on Podman or Docker, invoke:\n\n.. code-block:: sh\n\n    docker run --rm ghcr.io/daq-tools/skeem-standard \\\n        skeem infer-ddl --dialect=postgresql \\\n        https://github.com/daq-tools/skeem/raw/main/tests/testdata/basic.csv\n\nIf you want to work with files on your filesystem, you will need to either\nmount the working directory into the container using the ``--volume`` option,\nor use the ``--interactive`` option to consume STDIN, like:\n\n.. code-block:: sh\n\n    docker run --rm --volume=$(pwd):/data ghcr.io/daq-tools/skeem-standard \\\n        skeem infer-ddl --dialect=postgresql /data/basic.ndjson\n\n    docker run --rm --interactive ghcr.io/daq-tools/skeem-standard \\\n        skeem infer-ddl --dialect=postgresql --content-type=ndjson - \u003c basic.ndjson\n\nIn order to always run the latest ``nightly`` development version, and to use a\nshortcut for that, this section outlines how to use an alias for ``skeem``, and\na variable for storing the input URL. It may be useful to save a few keystrokes\non subsequent invocations.\n\n.. code-block:: sh\n\n    docker pull ghcr.io/daq-tools/skeem-standard:nightly\n    alias skeem=\"docker run --rm --interactive ghcr.io/daq-tools/skeem-standard:nightly skeem\"\n    URL=https://github.com/daq-tools/skeem/raw/main/tests/testdata/basic.ndjson\n\n    skeem infer-ddl --dialect=postgresql $URL\n\n\nMore\n----\n\nUse a different backend (default: ``ddlgen``)::\n\n    skeem infer-ddl --dialect=postgresql --backend=frictionless data.ndjson\n\nReading data from STDIN needs to obtain both the table name and content type separately::\n\n    skeem infer-ddl --dialect=crate --table-name=foo --content-type=ndjson - \u003c data.ndjson\n\nReading data from STDIN also works like this, if you prefer to use pipes::\n\n    cat data.ndjson | skeem infer-ddl --dialect=crate --table-name=foo --content-type=ndjson -\n\n\nLibrary use\n===========\n\n.. code-block:: python\n\n    import io\n    from skeem.core import SchemaGenerator\n    from skeem.model import Resource, SqlTarget\n\n    INDATA = io.StringIO(\n        \"\"\"\n        {\"id\":1,\"name\":\"foo\",\"date\":\"2014-10-31 09:22:56\",\"fruits\":\"apple,banana\",\"price\":0.42}\n        {\"id\":2,\"name\":\"bar\",\"date\":null,\"fruits\":\"pear\",\"price\":0.84}\n        \"\"\"\n    )\n\n    sg = SchemaGenerator(\n        resource=Resource(data=INDATA, content_type=\"ndjson\"),\n        target=SqlTarget(dialect=\"crate\", table_name=\"testdrive\"),\n    )\n\n    print(sg.to_sql_ddl().pretty)\n\n.. code-block:: sql\n\n    CREATE TABLE \"testdrive\" (\n        \"id\" INT NOT NULL,\n        \"name\" STRING NOT NULL,\n        \"date\" TIMESTAMP,\n        \"fruits\" STRING NOT NULL,\n        \"price\" DOUBLE NOT NULL,\n        PRIMARY KEY (\"id\")\n    );\n\n\n***********\nDevelopment\n***********\n\nFor installing the project from source, please follow the `development`_\ndocumentation.\n\n\n*******************\nProject information\n*******************\n\nCredits\n=======\n- `Catherine Devlin`_ for `ddlgenerator`_ and `data_dispenser`_.\n- `Mike Bayer`_ for `SQLAlchemy`_.\n- `Paul Walsh`_ and `Evgeny Karev`_ for `frictionless`_.\n- `Wes McKinney`_ for `pandas`_.\n- All other countless contributors and authors of excellent Python\n  packages, Python itself, and turtles all the way down.\n\nPrior art\n=========\nWe are maintaining a `list of other projects`_ with the same or similar goals\nlike Skeem.\n\nEtymology\n=========\nThe program was about to be called *Eskema*, but it turned out that there is\nalready another `Eskema`_ out there. So, it has been renamed to *Skeem*, which\nis Estonian, and means \"schema\", \"outline\", or \"(to) plan\".\n\n\n\n.. _Amazon S3: https://en.wikipedia.org/wiki/Amazon_S3\n.. _Apache Parquet: https://en.wikipedia.org/wiki/Apache_Parquet\n.. _Catherine Devlin: https://github.com/catherinedevlin\n.. _CSV: https://en.wikipedia.org/wiki/Comma-separated_values\n.. _data_dispenser: https://pypi.org/project/data_dispenser/\n.. _ddlgenerator: https://pypi.org/project/ddlgenerator/\n.. _development: doc/development.rst\n.. _Eskema: https://github.com/nombrekeff/eskema\n.. _Evgeny Karev: https://github.com/roll\n.. _file system: https://en.wikipedia.org/wiki/File_system\n.. _frictionless: https://github.com/frictionlessdata/framework\n.. _fsspec: https://pypi.org/project/fsspec/\n.. _GitHub: https://github.com/\n.. _Google Cloud Storage: https://en.wikipedia.org/wiki/Google_Cloud_Storage\n.. _Google Sheets: https://en.wikipedia.org/wiki/Google_Sheets\n.. _GRIB: https://en.wikipedia.org/wiki/GRIB\n.. _HTTP: https://en.wikipedia.org/wiki/HTTP\n.. _InfluxDB line protocol: https://docs.influxdata.com/influxdb/latest/reference/syntax/line-protocol/\n.. _JSON: https://www.json.org/\n.. _JSON Lines: https://jsonlines.org/\n.. _JSON streaming: https://en.wikipedia.org/wiki/JSON_streaming\n.. _LibreOffice: https://en.wikipedia.org/wiki/LibreOffice\n.. _list of other projects: doc/prior-art.rst\n.. _Microsoft Excel: https://en.wikipedia.org/wiki/Microsoft_Excel\n.. _Mike Bayer: https://github.com/zzzeek\n.. _NDJSON: http://ndjson.org/\n.. _NetCDF: https://en.wikipedia.org/wiki/NetCDF\n.. _Office Open XML Workbook: https://en.wikipedia.org/wiki/Office_Open_XML\n.. _OpenDocument Spreadsheet: https://en.wikipedia.org/wiki/OpenDocument\n.. _pandas: https://pandas.pydata.org/\n.. _Paul Walsh: https://github.com/pwalsh\n.. _ScipPy: https://scipy.org/\n.. _SQLAlchemy: https://pypi.org/project/SQLAlchemy/\n.. _testdata: https://github.com/daq-tools/skeem/tree/main/tests/testdata\n.. _Wes McKinney: https://github.com/wesm\n.. _xarray: https://xarray.dev/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaq-tools%2Fskeem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaq-tools%2Fskeem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaq-tools%2Fskeem/lists"}