示例#1
0
def add_data_to_place_table(context, named):
    """ Add entries into the place table. 'named places' makes sure that
        the entries get a random name when none is explicitly given.
    """
    with context.db.cursor() as cur:
        cur.execute('ALTER TABLE place DISABLE TRIGGER place_before_insert')
        for row in context.table:
            PlaceColumn(context).add_row(row, named is not None).db_insert(cur)
        cur.execute('ALTER TABLE place ENABLE TRIGGER place_before_insert')
示例#2
0
def update_place_table(context):
    """ Update the place table with the given data. Also runs all triggers
        related to updates and reindexes the new data.
    """
    context.nominatim.run_nominatim('refresh', '--functions')
    with context.db.cursor() as cur:
        for row in context.table:
            PlaceColumn(context).add_row(row, False).db_insert(cur)

    context.nominatim.reindex_placex(context.db)
    check_database_integrity(context)
示例#3
0
def update_place_table(context):
    """ Update the place table with the given data. Also runs all triggers
        related to updates and reindexes the new data.
    """
    context.nominatim.run_setup_script('create-functions',
                                       'create-partition-functions',
                                       'enable-diff-updates')
    with context.db.cursor() as cur:
        for row in context.table:
            PlaceColumn(context).add_row(row, False).db_insert(cur)

    context.nominatim.reindex_placex(context.db)
    check_database_integrity(context)