rustprooflabs / pgosm-flex

PgOSM Flex provides high quality OpenStreetMap datasets in PostGIS (Postgres) using the osm2pgsql Flex output.
MIT License
101 stars 20 forks source link

Managing osm.pgosm_flex via Sqitch breaks ability to move/remove osm schema #318

Closed rustprooflabs closed 1 year ago

rustprooflabs commented 1 year ago

What version of PgOSM Flex are you using?

0.8.0

What did you do exactly?

I loaded data to an external database, ran drop schema osm cascade; and re-ran import.

What did you expect to happen?

I expected the import to work.

What did happen instead?

The Sqitch deployment has no clue I dropped the osm schema, so does not try to create osm.pgosm_flex table. The insert into osm.pgosm_flex naturally fails...

2023-05-01 18:12:50,190:INFO:pgosm-flex:helpers:PgOSM Flex version:  0.8.0-8fb2621
Traceback (most recent call last):
  File "/app/docker/pgosm_flex.py", line 568, in <module>
    run_pgosm_flex()
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/app/docker/pgosm_flex.py", line 134, in run_pgosm_flex
    import_id = db.start_import(pgosm_region=helpers.get_region_combined(region, subregion),
  File "/app/docker/db.py", line 269, in start_import
    cur.execute(sql_raw, params=params)
  File "/usr/local/lib/python3.9/dist-packages/psycopg/cursor.py", line 723, in execute
    raise ex.with_traceback(None)
psycopg.errors.UndefinedTable: relation "osm.pgosm_flex" does not exist
LINE 2: INSERT INTO osm.pgosm_flex
                    ^

What did you do to try analyzing the problem?

I plan to create a .sql file to allow creating the osm.pgosm_flex table from Python when necessary.

rustprooflabs commented 1 year ago

Caused by #312

rustprooflabs commented 1 year ago

Merged into main via #328