Пример #1
0
def _init_and_clear_database():
    # creates database if necessary
    init_database()

    exec_sql("DROP OWNED BY osm_test")

    # prepare schema for tests
    current_directory = os.path.dirname(os.path.realpath(__file__))
    exec_sql_from_file('helpers/schema.sql.dump', cwd=current_directory)
    exec_sql_from_file('helpers/functions.sql', cwd=current_directory)
    export_osmnames.create_functions()

    # necessary for export tests
    if not os.path.exists('/tmp/osmnames/export/'):
        os.makedirs('/tmp/osmnames/export/')
Пример #2
0
def import_country_osm_grid():
    exec_sql_from_file("country_osm_grid.sql", cwd="{}/sql/".format(settings.get("DATA_DIR")))
Пример #3
0
def set_street_attributes_by_nearest_street():
    exec_sql_from_file("set_street_attributes_by_nearest_street.sql", cwd=SQL_DIR)
Пример #4
0
def schema(engine):
    current_directory = os.path.dirname(os.path.realpath(__file__))
    exec_sql_from_file('fixtures/test_prepare_imported_data.sql.dump',
                       cwd=current_directory)
Пример #5
0
def merge_corresponding_linestrings():
    exec_sql_from_file("merge_corresponding_linestrings.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Пример #6
0
def set_country_codes():
    exec_sql_from_file("set_country_codes.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
    consistency_check.missing_country_codes()
Пример #7
0
def create_custom_columns():
    exec_sql_from_file("create_custom_columns.sql", cwd=os.path.dirname(__file__))
Пример #8
0
def merge_linked_nodes():
    exec_sql_from_file("merge_linked_nodes/merge_nodes_linked_by_relation.sql",
                       cwd=os.path.dirname(__file__))
    vacuum_database()
Пример #9
0
def set_parent_ids():
    exec_sql_from_file("set_parent_ids.sql", cwd=SQL_DIR)
    vacuum_database()
Пример #10
0
def cluster_geometries():
    exec_sql_from_file("cluster_geometries.sql", cwd=SQL_DIR)
    vacuum_database()
Пример #11
0
def set_geometry_centers():
    exec_sql_from_file("set_geometry_centers.sql", cwd=SQL_DIR)
    vacuum_database()
Пример #12
0
def create_geonames_view():
    exec_sql_from_file("create_geonames_view.sql", cwd=os.path.dirname(__file__))
Пример #13
0
def create_housenumbers_view():
    exec_sql_from_file("create_housenumbers_view.sql", cwd=os.path.dirname(__file__))
Пример #14
0
def create_merged_linestrings_view():
    exec_sql_from_file("create_merged_linestrings_view.sql", cwd=os.path.dirname(__file__))
Пример #15
0
def set_names_from_tags():
    exec_sql_from_file("set_names_from_tags.sql", cwd=SQL_DIR)
Пример #16
0
def set_tables_unlogged():
    exec_sql_from_file("set_tables_unlogged.sql",
                       cwd=os.path.dirname(__file__),
                       parallelize=True)
Пример #17
0
def set_geometry_centers():
    exec_sql_from_file("set_geometry_centers.sql", cwd=SQL_DIR)
    vacuum_database()
Пример #18
0
def set_polygon_types():
    exec_sql_from_file("set_polygon_types.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Пример #19
0
def cluster_geometries():
    exec_sql_from_file("cluster_geometries.sql", cwd=SQL_DIR)
    vacuum_database()
Пример #20
0
def delete_unusable_entries():
    exec_sql_from_file("delete_unusable_entries.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Пример #21
0
def set_parent_ids():
    exec_sql_from_file("set_parent_ids.sql", cwd=SQL_DIR)
    vacuum_database()
Пример #22
0
def set_place_parentInfo():
    exec_sql_from_file("set_place_parentInfo.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Пример #23
0
def create_custom_columns():
    exec_sql_from_file("create_custom_columns.sql", cwd=os.path.dirname(__file__))
Пример #24
0
def create_custom_types():
    exec_sql_from_file("create_custom_types.sql",
                       cwd=os.path.dirname(__file__),
                       user="******")
Пример #25
0
def set_linestring_centers():
    exec_sql_from_file("set_linestring_centers.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Пример #26
0
def create_functions():
    exec_sql_from_file("functions.sql", cwd=os.path.dirname(__file__))
Пример #27
0
def delete_unusable_entries():
    exec_sql_from_file("delete_unusable_entries.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Пример #28
0
def sanitize_housenumbers():
    exec_sql_from_file("sanitize_housenumbers.sql", cwd=SQL_DIR)
Пример #29
0
def set_place_ranks():
    exec_sql_from_file("set_place_ranks.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Пример #30
0
def set_country_codes():
    exec_sql_from_file("set_country_codes.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
    consistency_check.missing_country_codes()
Пример #31
0
def determine_linked_places():
    exec_sql_from_file("determine_linked_places.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Пример #32
0
def set_linestring_names_from_relations():
    exec_sql_from_file("set_linestring_names_from_relations.sql", cwd=SQL_DIR)
Пример #33
0
def merge_corresponding_linestrings():
    exec_sql_from_file("merge_corresponding_linestrings.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Пример #34
0
def create_helper_functions():
    exec_sql_from_file("create_helper_functions.sql",
                       cwd=os.path.dirname(__file__),
                       parallelize=True)
Пример #35
0
def create_functions():
    exec_sql_from_file("functions.sql", cwd=os.path.dirname(__file__))
Пример #36
0
def delete_nameless_entries():
    exec_sql_from_file("delete_nameless_entries.sql",
                       cwd=os.path.dirname(__file__),
                       parallelize=True)
    vacuum_database()
Пример #37
0
def create_merged_linestrings_view():
    exec_sql_from_file("create_merged_linestrings_view.sql",
                       cwd=os.path.dirname(__file__))
Пример #38
0
def follow_wikipedia_redirects():
    exec_sql_from_file("follow_wikipedia_redirects.sql",
                       cwd=os.path.dirname(__file__))
    vacuum_database()
Пример #39
0
def create_housenumbers_view():
    exec_sql_from_file("create_housenumbers_view.sql",
                       cwd=os.path.dirname(__file__))
Пример #40
0
def set_linestring_centers():
    exec_sql_from_file("set_linestring_centers.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Пример #41
0
def create_geonames_view():
    exec_sql_from_file("create_geonames_view.sql",
                       cwd=os.path.dirname(__file__))
Пример #42
0
def set_place_ranks():
    exec_sql_from_file("set_place_ranks.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Пример #43
0
def merge_nodes_linked_by_relation():
    exec_sql_from_file("merge_nodes_linked_by_relation.sql", cwd=SQL_DIR)
    vacuum_database()
Пример #44
0
def determine_linked_places():
    exec_sql_from_file("determine_linked_places.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Пример #45
0
def set_street_attributes_by_street_relation_members():
    exec_sql_from_file("set_street_attributes_by_street_relation_members.sql", cwd=SQL_DIR)
Пример #46
0
def add_missing_streetnames_postcodes_cities():
    exec_sql_from_file("add_missing_streetnames_postcodes_cities.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Пример #47
0
def set_street_names_by_relation_attributes():
    exec_sql_from_file("set_street_names_by_relation_attributes.sql", cwd=SQL_DIR)
Пример #48
0
def remove_duplicate_entries():
    exec_sql_from_file("remove_duplicate_entries.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Пример #49
0
def normalize_street_names():
    exec_sql_from_file("normalize_street_names.sql", cwd=SQL_DIR)
Пример #50
0
def schema(engine):
    current_directory = os.path.dirname(os.path.realpath(__file__))
    exec_sql_from_file('fixtures/test_export_osmnames.sql.dump', cwd=current_directory)
    create_functions()
Пример #51
0
def set_street_ids_by_street_name():
    exec_sql_from_file("set_street_ids_by_street_name.sql", cwd=SQL_DIR)
Пример #52
0
def import_country_osm_grid():
    exec_sql_from_file("country_osm_grid.sql",
                       cwd="{}/sql/".format(settings.get("DATA_DIR")))
Пример #53
0
def create_custom_types():
    exec_sql_from_file("create_custom_types.sql", cwd=os.path.dirname(__file__), user="******")