X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fipsilon.git;a=blobdiff_plain;f=ipsilon%2Futil%2Fdata.py;h=65bf4b539d0f40cffb39e25b4c2b90b8493f3dac;hp=52fde62cca62051dda486d99aa711369e558fc14;hb=4d25f65e78ed2343cde4948172d876e084764731;hpb=2b17119bb97eba45030d18f590624c2b2a9f257e diff --git a/ipsilon/util/data.py b/ipsilon/util/data.py index 52fde62..65bf4b5 100644 --- a/ipsilon/util/data.py +++ b/ipsilon/util/data.py @@ -69,7 +69,10 @@ class SqlStore(BaseStore): # It's not possible to share connections for SQLite between # threads, so let's use the SingletonThreadPool for them pool_args = {'poolclass': SingletonThreadPool} - self._dbengine = create_engine(engine_name, **pool_args) + self._dbengine = create_engine(engine_name, + echo=cherrypy.config.get('db.echo', + False), + **pool_args) self.is_readonly = False def add_constraint(self, constraint): @@ -507,7 +510,8 @@ class Store(Log): q = self._query(self._db, table, columns, trans=False) rows = q.select(kvfilter) except Exception, e: # pylint: disable=broad-except - self.error("Failed to load data for table %s: [%s]" % (table, e)) + self.error("Failed to load data for table %s for store %s: [%s]" + % (table, self.__class__.__name__, e)) return self._rows_to_dict_tree(rows) def load_config(self): @@ -735,6 +739,14 @@ class UserStore(Store): else: raise NotImplementedError() + def create_plugin_data_table(self, plugin_name): + if not self.is_readonly: + table = plugin_name+'_data' + q = self._query(self._db, table, OPTIONS_TABLE, + trans=False) + q.create() + q._con.close() # pylint: disable=protected-access + class TranStore(Store):