Metadata-Version: 2.1
Name: amsterdam-schema-tools
Version: 0.0.3
Summary: Tools to work with Amsterdam schema.
Home-page: https://github.com/amsterdam/schema-tools
Author: Jan Murre
Author-email: jan.murre@catalyz.nl
License: Mozilla Public 2.0
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Description-Content-Type: text/markdown
Requires-Dist: geoalchemy2
Requires-Dist: psycopg2
Requires-Dist: click
Requires-Dist: jsonschema
Requires-Dist: amsterdam-schema
Requires-Dist: ndjson
Requires-Dist: shapely

# amsterdam-schema-tools

Set of libraries and tools to work with Amsterdam schema.

Install the package with: `pip install amsterdam-schema-tools`

Currently, the following cli commands are available:

    - schema fetch tablenames
    - schema create schema <dataset-id> <list-of-tablenames>

The tools expect either a DATABASE_URL environment variable or a command-line option `--db-url` with a DSN.

The output is a json-schema output according to the Amsterdam schemas definition for the tables that are being processed.

The --prefix argument controls whether table prefixes are removed in the schema, because that is required for Django
models.

As example we can generate a BAG schema. Point DATABASE_URL to bag_v11 database and then run :

    schema fetch tablenames | sort | awk '/^bag_/{print}' | xargs schema create schema bag --prefix bag_ | jq

The **jq** formats it nicely and it can be redirected to the correct directory in the schemas repository directly.


