Skip to main content

dbgdb

Project description

This is a library containing Luigi tasks to help you get that data into (and out of) your GIS databases. The library also comes with a command-line interface based on Click that can be helpful for running tasks individually.

Getting Started

Prerequisites

pip install

You can use pip to install the library itself.

pip install dbgdb

GDAL/OGR

You will also need ogr2ogr which you can get by installing GDAL.

Note: In this early version we expect ``ogr2ogr`` to be in your system path. Improvements on that point are forthcoming.

Using Tasks

This library contains a number of tasks that you can use in your Luigi pipelines.

PgLoadTask

Use `PgLoadTask <https://dbgdb.readthedocs.io/en/latest/api.html#dbgdb.tasks.postgres.load.PgLoadTask>`__ task to import your data (likely a file geodatabase) to your PostgreSQL database.

PgExtractTask

Use a `PgExtractTask <https://dbgdb.readthedocs.io/en/latest/api.html#dbgdb.tasks.postgres.extract.PgExtractTask>`__ to get your data out of the database.

PgDropSchemaTask

If you need to drop the import schema because you’re starting the process over, use `PgDropSchemaTask <https://dbgdb.readthedocs.io/en/latest/api.html#dbgdb.tasks.postgres.drop.PgDropSchemaTask>`__.

Using the Command Line

A Note about the CLI and Luigi

Most of the commands you run with the command-line interface (CLI) create Luigi tasks which are then submitted to a Luigi scheduler. The -l parameter indicates that the tasks should be run using the local scheduler. The examples listed below use this parameter.

Getting Help

dbgdb has its own command-line help.

dbgdb --help

Load Data

You can load a file geodatabase with the load subcommand.

dbgdb -l load --schema myschema /path/to/your/data.gdb

Extract Data

You can extract all of the data within a schema to an output file with the extract subcommand.

dbgdb -l extract  --schema myschema /path/to/your/exported/data.db

Note: At the moment, we can export to `GeoPackage <https://www.geopackage.org/>`__ or `Spatialite <https://www.gaia-gis.it/fossil/libspatialite/index>`__ formats. Support for ESRI File Geodatabses (gdb) is still in the works.

Drop a Schema

If the target schema for your load command already exists, you may notice Luigi reports there was nothing to do because, from the task’s perspective, the work is already done. If you need to drop a schema, you can use the drop subcommand.

dbgdb -l drop schema myschema

Resources

Would you like to learn more? Check out the links below!

Authors

  • Pat Daburu - Initial work - github

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
dbgdb-0.0.5.tar.gz (11.8 kB) Copy SHA256 hash SHA256 Source None Jul 7, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page