]> code.communitydata.science - taguette_google_sheet_integration.git/blobdiff - taguette-export_tags_to_csv.py
Changed delimiter to _ from .
[taguette_google_sheet_integration.git] / taguette-export_tags_to_csv.py
index 7ba5a9127722b84572f32e97727638b5fda1ed0a..53a5c488be72d6efa0f798868bd5c0bc9a683e2c 100755 (executable)
@@ -11,11 +11,16 @@ config.read('.taguette_gdocs')
 project_id = int(config['General']['taguette_project_id'])
 taguette_database_file = config['General']['taguette_database_file']
 
+
 ## connect to sqlite3
 con = sqlite3.connect(taguette_database_file)
 cur = con.cursor()
 
+# Run this if you just want tags and no highlights
 sql_stmt_get = "SELECT id, path, description FROM tags WHERE project_id = ?"
+
+# Run this if you want tags AND highlights
+#sql_stmt_get = "SELECT tags.id, tags.path, tags.description, highlights.snippet FROM highlight_tags INNER JOIN tags ON highlight_tags.tag_id = tags.id INNER JOIN highlights ON highlight_tags.highlight_id = highlights.id WHERE project_id = ?"
 cur.execute(sql_stmt_get, (project_id,))
 
 while True:
@@ -25,7 +30,7 @@ while True:
         
     tag_id, path, description = row
 
-    m = re.match(r'^(.+)\.(.*)$', path)
+    m = re.match(r'^(.+)\_(.*)$', path) 
     if m:
         axial = m.group(1)
         tag = m.group(2)

Community Data Science Collective || Want to submit a patch?