Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error populating geography.city #282

Open
simcop2387 opened this issue Feb 28, 2022 · 1 comment
Open

Error populating geography.city #282

simcop2387 opened this issue Feb 28, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@simcop2387
Copy link
Contributor

Describe the bug
A clear and concise description of what the bug is.

Bootstrap script fails during the populating of geography.city due to security changes from psycopg2
psycopg/psycopg2#1294

A quick work around is to change that population to set the search path and make the function read like the following:

...
    with open("city.dump") as dump_file:
        cursor = db.db.cursor()
        cursor.execute("SET search_path TO geography")
        cursor.copy_from(
            dump_file,
            "city",
            columns=(
                "region_id",
                "timezone_id",
                "name",
                "latitude",
                "longitude",
                "population",
            ),
        )
    remove("city.dump")

To Reproduce
Steps to reproduce the behavior:
Run the bootstrap script

Expected behavior
You do not get an error about a missing table because of the schema name

Log files

Populating geography.city table
Traceback (most recent call last):
  File "/opt/selene/selene-backend/db/scripts/bootstrap_mycroft_db.py", line 386, in <module>
    _populate_db()
  File "/opt/selene/selene-backend/db/scripts/bootstrap_mycroft_db.py", line 378, in _populate_db
    _populate_city_table(mycroft_db)
  File "/opt/selene/selene-backend/db/scripts/bootstrap_mycroft_db.py", line 351, in _populate_city_table
    cursor.copy_from(
psycopg2.errors.UndefinedTable: relation "geography.city" does not exist
@simcop2387 simcop2387 added the bug Something isn't working label Feb 28, 2022
@chrisveilleux
Copy link
Member

Thanks for reporting this, @simcop2387. This has been addressed in PR #308. It will be included in the upcoming release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants