Database: add reload method; re-expand fields before reindexing
This commit is contained in:
parent
9ab7b6cfc1
commit
331e6d4668
@ -739,6 +739,13 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
|
|||||||
else:
|
else:
|
||||||
return super().get_table_func(table, func)
|
return super().get_table_func(table, func)
|
||||||
|
|
||||||
|
def reload(self):
|
||||||
|
"""
|
||||||
|
Reload, and recreate tables (if necessary).
|
||||||
|
Useful after db.drop_tables()
|
||||||
|
"""
|
||||||
|
self.load(self._directory)
|
||||||
|
|
||||||
def load(self, directory, callback=None, mode=None,
|
def load(self, directory, callback=None, mode=None,
|
||||||
force_schema_upgrade=False,
|
force_schema_upgrade=False,
|
||||||
force_bsddb_upgrade=False,
|
force_bsddb_upgrade=False,
|
||||||
|
@ -1225,8 +1225,12 @@ class DBAPI(DbGeneric):
|
|||||||
callback(5)
|
callback(5)
|
||||||
|
|
||||||
def rebuild_secondary(self, update):
|
def rebuild_secondary(self, update):
|
||||||
|
# First, expand blob to individual fields:
|
||||||
|
self.rebuild_secondary_fields()
|
||||||
|
# Next, rebuild stats:
|
||||||
gstats = self.get_gender_stats()
|
gstats = self.get_gender_stats()
|
||||||
self.genderStats = GenderStats(gstats)
|
self.genderStats = GenderStats(gstats)
|
||||||
|
# Rebuild all order_by fields:
|
||||||
## Rebuild place order_by:
|
## Rebuild place order_by:
|
||||||
self.dbapi.execute("""select blob_data from place;""")
|
self.dbapi.execute("""select blob_data from place;""")
|
||||||
row = self.dbapi.fetchone()
|
row = self.dbapi.fetchone()
|
||||||
|
Loading…
Reference in New Issue
Block a user