validate_table_name

pydriosm.ios.validate_table_name(table_name, sub_space='')[source]

Validate a table name for importing OSM data into a PostgreSQL database.

Parameters
  • table_name (str) – name as input of a table in a PostgreSQL database

  • sub_space (str) – substitute for space

Returns

valid name of the table in the database

Return type

str

Examples:

>>> from pydriosm.ios import validate_table_name

>>> sr_name = 'greater london'
>>> tbl_name = validate_table_name(sr_name)

>>> print(tbl_name)
# greater london

>>> sr_name = 'Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch, Wales'
>>> tbl_name = validate_table_name(sr_name, sub_space='_')

>>> print(tbl_name)
# Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch_W..