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.
You can use pip to install the library itself.
pip install dbgdb
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.
This library contains a number of tasks that you can use in your Luigi pipelines.
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.
Use a `PgExtractTask <https://dbgdb.readthedocs.io/en/latest/api.html#dbgdb.tasks.postgres.extract.PgExtractTask>`__ to get your data out of the database.
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.
dbgdb has its own command-line help.
You can load a file geodatabase with the load subcommand.
dbgdb -l load --schema myschema /path/to/your/data.gdb
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
This project is licensed under the MIT License - see the LICENSE.md file for details