Skip to content

Commit 40f160c

Browse files
committed
Fix functional sqlite excel importer
1 parent 60e4760 commit 40f160c

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

activity_browser/bwutils/importers.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ def database_class(self, db_name: str, requested_backend: str = "sqlite") -> bd.
4444
except ImportError:
4545
return bd.Database(db_name, backend=requested_backend)
4646

47+
@property
48+
def needs_multifunctional_database(self) -> bool:
49+
return any(ds.get("processor") for ds in self.data)
50+
4751
def write_database(self, **kwargs):
4852
"""Go to the parent of the ExcelImporter class, not the ExcelImporter itself.
4953
@@ -65,8 +69,8 @@ def simple_automated_import(
6569

6670
def automated_import(self, db_name: str, relink: dict = None) -> list:
6771
self.strategies = [
68-
functools.partial(alter_database_name, old=self.db_name, new=db_name),
6972
csv_restore_tuples,
73+
functools.partial(alter_database_name, old=self.db_name, new=db_name),
7074
csv_restore_booleans,
7175
csv_numerize,
7276
csv_drop_unknown,

activity_browser/bwutils/strategies.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ def alter_database_name(data: list, old: str, new: str) -> list:
253253
# Any parameters found here are activity parameters and we can
254254
# overwrite the database without issue.
255255
d["database"] = new
256+
if ds.get("processor", (None, None))[0] == old:
257+
ds["processor"] = (new, ds["processor"][1])
256258
return data
257259

258260

0 commit comments

Comments
 (0)