file_table_reader/database.py
2025-11-25 15:33:38 +07:00

22 lines
486 B
Python

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'"
)