https://github.com/gacarrillor/pg2ili
Python script to import tables from a PostgreSQL/PostGIS SQL file to INTERLIS
https://github.com/gacarrillor/pg2ili
gis interlis interoperability ogc postgis postgresql python sql
Last synced: about 2 months ago
JSON representation
Python script to import tables from a PostgreSQL/PostGIS SQL file to INTERLIS
- Host: GitHub
- URL: https://github.com/gacarrillor/pg2ili
- Owner: gacarrillor
- License: gpl-3.0
- Created: 2019-11-30T04:56:26.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-09-09T16:28:45.000Z (over 1 year ago)
- Last Synced: 2025-04-11T17:49:21.609Z (12 months ago)
- Topics: gis, interlis, interoperability, ogc, postgis, postgresql, python, sql
- Language: Python
- Size: 174 KB
- Stars: 2
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pg2ili
Python script to import tables and relationships from a PostgreSQL/PostGIS SQL (DDL) file to [INTERLIS](https://www.interlis.ch/en).

pg2ili was created for saving time when extracting (or reverse engineering) information about the structure of an existing physical model.
If you start from a PostgreSQL/PostGIS database and want to obtain an INTERLIS model from it, you can use pg2ili to get all your PG tables written as INTERLIS classes. Then you can open the obtained ili file in [UML/INTERLIS Editor](https://github.com/claeis/umleditor) and adjust your model, i.e., adding meta-attributes, adjusting numeric ranges, among others.
**Usage:**
Go to pgAdmin v3 or v4 and create a (SQL) plain backup of your database schema. Now go to a terminal and run:
python3 ./pg2ili.py /docs/backup.sql My_New_Model My_New_Topic > /docs/my_model.ili
**Examples:**
See the `tests/` folder for input and output examples.
**Unit tests:**
To run the unit tests, open the project in PyCharm, open `tests.py` file and press `Ctrl + Shift + F10`.
Individual tests can be run by typing this in a console (from repo folder):
python3 -m unittest tests.tests.TestPG2ILI.test_sql13