Setup Db
initialize_database(db_type, path=None, reset=False, env_path=None)
Orchestrates the provisioning of the spatial database schema based on the dialect preference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
db_type
|
str
|
The requested database dialect ('sqlite' or 'postgres'). |
required |
path
|
Optional[str]
|
Optional file path for local SQLite deployments. Defaults to 'phytospatial_local.gpkg'. |
None
|
reset
|
bool
|
Instructs the engine to delete an existing local database file or drop all tables. |
False
|
env_path
|
Optional[Union[str, Path]]
|
Filepath to a .env configuration file containing database credentials. |
None
|
Raises:
| Type | Description |
|---|---|
SystemExit
|
If database dependencies are missing or the schema deployment fails. |