DatabaseConfig¶
- class passengersim.config.DatabaseConfig[source]¶
Bases:
PrettyModelAttributes:
Database engine to use.
Exact persistent database destination; None leaves naming to the storage policy.
Storage and retention policy, shared by all simulation interfaces.
Parent of unique run directories, never an exact database filename.
Whether to use pre-compiled SQL write instructions.
A list of PRAGMA commands to execute upon opening a database connection.
Commit transactions to the database will only be honored this frequently.
Which items should be written to the database.
Should leg bid prices be stored in the database.
Should leg displacements be stored in the database.
- engine : Literal['sqlite', None]¶
Database engine to use.
Currently only sqlite is fully implemented.
- filename : Path | None¶
Exact persistent database destination; None leaves naming to the storage policy.
The legacy value ‘:memory:’ selects real memory storage. To disable recording, set engine=None or set the entire database configuration to None.
- result_storage : Literal['temporary', 'persistent', 'memory', 'summary_only'] | None¶
Storage and retention policy, shared by all simulation interfaces.
None selects persistent storage when a filename is supplied, memory for ‘:memory:’, and temporary storage otherwise. Memory is standalone-only. Summary-only computes requested database reports before discarding raw data.
- result_directory : Path | None¶
Parent of unique run directories, never an exact database filename.
Temporary storage defaults to the OS temporary directory. Persistent storage requires either this directory or an exact filename, but never both.
- fast : bool¶
Whether to use pre-compiled SQL write instructions.
- pragmas : list[str]¶
A list of PRAGMA commands to execute upon opening a database connection.
- commit_count_delay : int | None¶
Commit transactions to the database will only be honored this frequently.
By setting this number greater than 1, the transaction frequency will be reduced, improving overall runtime performance by storing more data in RAM and writing to persistent storage less frequently.
- write_items : set[Literal['leg', 'bucket', 'edgar', 'fare', 'demand', 'leg_daily', 'leg_final', 'bucket_final', 'fare_final', 'demand_final', 'bookings', 'pathclass', 'pathclass_daily', 'pathclass_final']]¶
Which items should be written to the database.
The following values can be provided in this set:
leg: write every leg to the leg_detail table at every DCP.
leg_final: write every leg to the leg_detail table only at DCP 0.
bucket: write every leg bucket to the leg_bucket_detail table at every DCP.
- bucket_final: write every leg bucket to the leg_bucket_detail table only
at DCP 0.
fare: write every fare to the fare_detail table at every DCP.
fare_final: write every fare to the fare_detail table only at DCP 0.
demand: write every demand to the demand_detail table at every DCP.
- bookings: store booking summary data at every DCP and write an aggregate
summary of bookings by DCP to the bookings_by_timeframe table at the end of the simulation.
- store_leg_bid_prices : bool¶
Should leg bid prices be stored in the database.
- store_displacements : bool¶
Should leg displacements be stored in the database.