connection object also supports using a table prepend which is a string prepended to every table the web.database module uses but is totally transparent to the programmer.
You can use a table prepend like this:
connection = web.database.connect( adapter="SnakeSQL", database="C:/TestDirectory", prepend = 'Test', )
Every table created will have the word
Test prepended to its name but you would access the database as if no prepend existed. For example if you created tables named
Houses they would actually be created as
TestHouses but a call to
cursor.tables() would return
('People', 'Houses') so that you can treat the database as if no prepend exists.
This is very handy as it means that you could, for example, setup test, development and production environments all within the same database simply by modifying the table prepend and no other changes to your code need to be made. It also means you can run more than one copy of code which uses a database in the same database but with each connection having a different table prepend. This is useful in a shared hosting environment where the number of databases you have access to is restricted.