[chronojump/import-runs] chronojump-importer: imports RunTypes, Runs and the needed Person77 and PersonSessions77 for Run's t
- From: Carles Pina i Estany <carlespina src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump/import-runs] chronojump-importer: imports RunTypes, Runs and the needed Person77 and PersonSessions77 for Run's t
- Date: Fri, 30 Sep 2016 12:51:12 +0000 (UTC)
commit b2eeffb06d59846d256fa5ec53a7ae5f839d3794
Author: Carles Pina i Estany <carles pina cat>
Date: Fri Sep 30 14:49:48 2016 +0200
chronojump-importer: imports RunTypes, Runs and the needed Person77 and PersonSessions77 for Run's table.
src/chronojump-importer/chronojump_importer.py | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/chronojump-importer/chronojump_importer.py b/src/chronojump-importer/chronojump_importer.py
index 04e449a..683cf18 100755
--- a/src/chronojump-importer/chronojump_importer.py
+++ b/src/chronojump-importer/chronojump_importer.py
@@ -417,6 +417,16 @@ def import_database(source_path, destination_path, source_session):
matches_columns=destination_db.column_names("JumpRjType", ["uniqueID"]),
avoids_duplicate_column="name")
+ # Imports RunTypes table
+ run_types = source_db.read(table_name="RunType",
+ where_condition="Session.uniqueID={}".format(source_session),
+ join_clause="LEFT JOIN Run ON RunType.name=Run.type LEFT JOIN Session ON
Run.sessionID=Session.uniqueID",
+ group_by_clause="RunType.uniqueID")
+
+ destination_db.write(table=run_types,
+ matches_columns=destination_db.column_names("RunType", ["uniqueID"]),
+ avoids_duplicate_column="name")
+
# Imports Persons77 used by JumpRj table
persons77_jump_rj = source_db.read(table_name="Person77",
where_condition="JumpRj.sessionID={}".format(source_session),
@@ -429,9 +439,15 @@ def import_database(source_path, destination_path, source_session):
join_clause="LEFT JOIN Jump ON Person77.uniqueID=Jump.personID",
group_by_clause="Person77.uniqueID")
+ persons77_run = source_db.read(table_name="Person77",
+ where_condition="Run.sessionID={}".format(source_session),
+ join_clause="LEFT JOIN Run ON Person77.uniqueID=Run.personID",
+ group_by_clause="Person77.uniqueID")
+
persons77 = Table("person77")
persons77.concatenate_table(persons77_jump)
persons77.concatenate_table(persons77_jump_rj)
+ persons77.concatenate_table(persons77_run)
persons77.remove_duplicates()
destination_db.write(table=persons77,
@@ -457,6 +473,13 @@ def import_database(source_path, destination_path, source_session):
destination_db.write(table=jump, matches_columns=None)
+ # Imports Run table (with the new Person77's uniqueIDs)
+ run = source_db.read(table_name="Run",
+ where_condition="Run.sessionID={}".format(source_session))
+ run.update_ids("personID", persons77, "uniqueID", "new_uniqueID")
+ run.update_session_ids(new_session_id)
+ run.update_ids("type", jump_types, "old_name", "new_name")
+
# Imports PersonSession77
person_session_77 = source_db.read(table_name="PersonSession77",
where_condition="PersonSession77.sessionID={}".format(source_session))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]