IaaGeoDataCleaning.ConnectionUtils package¶
Submodules¶
IaaGeoDataCleaning.ConnectionUtils.DatabaseConnector module¶
-
class
IaaGeoDataCleaning.ConnectionUtils.DatabaseConnector.DatabaseConnector¶ Bases:
object-
close_connection()¶
-
connect_from_config(section='postgresql', file_path=False)¶ Connect to database from parameters.
Parameters: - file_path –
- section –
Returns:
-
connect_from_credentials(host, dbname, username, password, port=5432)¶ Set up from keywords, not secure.
Parameters: - host –
- dbname –
- username –
- password –
- port –
-
get_connection()¶
-
IaaGeoDataCleaning.ConnectionUtils.Table module¶
-
class
IaaGeoDataCleaning.ConnectionUtils.Table.Table(tableName, databaseConnector)¶ Bases:
object-
change_table(new_table)¶ Switch to a different table without creating a new DatabaseConnector.
Parameters: new_table – Returns:
-
check_by_countryloc(country_name, location_name, countrycol_name='country', locationcol_name='location')¶ Check if an entry exists with the given country and location. If so, return all rows that match in a tuple where the first value is True or False for whether an entry exist, and the second value is the the rows.
Parameters: - country_name –
- location_name –
Returns:
-
check_by_latlng(lat, lon, search_radius=300000, geomcol_name='geom')¶ Check if an entry with the given lat, lon exists. If so, return all rows that match in a tuple where the first value is True or False for whether an entry exist, and the second value is the the rows.
Parameters: - lat –
- lon –
Returns:
-
check_validity(world_table_name, new_typecol_name='dtype', new_foundcountrycol_name='dbCountry', points_geomcol_name='geom', world_geomcol_name='geom', wolrd_countrycodecol_name='gid_0', points_countrycodecol_name='country_code', world_countrynamecol_name='name_0')¶ Validate using data in the database whether the entries in the table have the correct country.
Parameters: world_table_name – Returns:
-
commit_changes()¶ Commit changes made to the database.
Returns:
-
entries_by_input(vals, column_names)¶ Return all entries that match ALL search terms. Returns False if an error occurs.
Parameters: vals – Returns:
-
get_table(limit=5)¶ Return a number of rows of the table. If limit=0, return all.
Parameters: limit – Returns:
-
is_spatial(geomcol_name='geom')¶ Check if the given table is spatial.
Returns:
-
make_spatial(lngcol_name='Longitude', latcol_name='Latitude', geomcol_name='geom')¶ Add a geometry column and make it spatial.
Returns:
-
table_from_file(file_path=False)¶ Create a table on the database from a .xlsx or .csv file.
Parameters: file_path – Returns:
-
table_from_tuple(command_tuple)¶ Build table(s) from a command(s).
Returns:
-
table_to_csv(file_name)¶
-
update_entries(lngcol_name='longitude', latcol_name='latitude', countrycol_name='country', locationcol_name='location', file_path=False)¶ Insert or update entries from a .csv file.
Parameters: file_path – Returns:
-
xlsx_to_csv(file_path)¶
-