file_table_reader/database.py

22 lines
486 B
Python
Raw Normal View History

2025-11-25 08:33:38 +00:00
POSTGIS = {
"host": "192.168.60.24",
"port": "5432",
"db": "test_postgis",
"user": "postgres",
"password": "12345"
}
def build_uri(table_name: str) -> str:
return (
f"dbname='{POSTGIS['db']}' "
f"host='{POSTGIS['host']}' "
f"port='{POSTGIS['port']}' "
f"user='{POSTGIS['user']}' "
f"password='{POSTGIS['password']}' "
f"sslmode=disable "
f"table=\"public\".\"{table_name}\" "
f"key='_id'"
)