Well, If I well understood the problem, I think you can have something like: 0.py with a connection to a shared database database_to_use = request.application db = DAL(shared_db) db.define_table(Field('db_name', 'string')) row = db().select(db.shared_db.db_name==database_to_use).select().first() if not row: db.shared_db.insert(db_name=database_to_use)
Now in your db.py you can have another connection to retrieve db name and use it and guess what if you forgot and ran your application without creating the intended database manually db.py will fail