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

Creating tables and indexes in autocommit mode #3631

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/nominatim_db/clicmd/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,16 @@ async def async_run(self, args: NominatimArgs) -> int:

LOG.warning('Post-process tables')
with connect(args.config.get_libpq_dsn()) as conn:
conn.autocommit = True
await database_import.create_search_indices(conn, args.config,
drop=args.no_updates,
threads=num_threads)
LOG.warning('Create search index for default country names.')
conn.autocommit = False
country_info.create_country_names(conn, tokenizer,
args.config.get_str_list('LANGUAGES'))
if args.no_updates:
conn.autocommit = True
freeze.drop_update_tables(conn)
tokenizer.finalize_import(args.config)

Expand Down Expand Up @@ -183,6 +186,7 @@ def _setup_tables(self, config: Configuration, reverse_only: bool) -> None:
from ..tools import database_import, refresh

with connect(config.get_libpq_dsn()) as conn:
conn.autocommit = True
LOG.warning('Create functions (1st pass)')
refresh.create_functions(conn, config, False, False)
LOG.warning('Create tables')
Expand Down
Loading