A number of changes are being made to the opus database framework. This page documents the changes that you need to make to your machines and code in order for the most recent version of opus to work properly. You should report problems that you encounter while upgrading or running the new version to the urbansim mailing list.

Machine updates

Sqlalchemy 0.4 is now a required python package. Sqlalchemy allows us to support MySQL, Postgres, and MSSQL databases.

Code changes

Changes that may affect you

  • Much of the database framework is now located in opus_core.database_management
  • opus_core.store.mysql_storage is replaced by opus_core.store.sql_storage
  • opus_core.store.scenario_database is now deprecated. All uses of ScenarioDatabase must be replaced.
  • opus_core.database_management.database_server_configuration should be used instead of opus_core.configurations.database_server_configuration
  • opus_core.database_management.database_server_configuration allows you to specify the database "protocol" that you wish to use. It defaults to mysql, but can also connect to mssql, postgres, sqlite, amongst others.

Steps to upgrade a configuration script

  1. Remove ScenarioDatabase imports
  2. Make sure that you import DatabaseServer and DatabaseServerConfiguration:

from opus_core.database_management.database_server import DatabaseServer from opus_core.database_management.database_server_configuration import DatabaseServerConfiguration

  1. Create your baseyear database. If you need to specify a hostname, user name, password, or protocol, you may do so as a parameter to DatabaseServerConfiguration:

#define our connection to the database server
db_server_config = DatabaseServerConfiguration()
#establish a connection to the server
database_server = DatabaseServer(db_server_config)
#get our database
scenario_database = database_server.get_database('eugene_1980_baseyear')

  1. Update your the 'in_storage' key in your configuration dictionary to: 'in_storage':
    StorageFactory().get_storage(
    'sql_storage',
    storage_location = scenario_database
    ),
  1. Update the CreatingBaseyearCacheConfiguration object in the configuration.
    1. Rename the cache_mysql_data parameter to cache_scenario_database
    2. Convert all references to 'urbansim.model_coordinators.cache_mysql_data' to 'urbansim.model_coordinators.cache_scenario_database'