#!/usr/bin/env python3 import re import sqlite3 ## connect to sqlite3 con = sqlite3.connect('taguette-working.sqlite3') cur = con.cursor() ## this is the hardcoded project id project_id = 13 sql_stmt_get = "SELECT id, path, description FROM tags WHERE project_id = ?" cur.execute(sql_stmt_get, (project_id,)) while True: row = cur.fetchone() if row == None: break tag_id, path, description = row m = re.match(r'^(.+)\.(.*)$', path) if m: axial = m.group(1) tag = m.group(2) else: axial = "" tag = path print("\t".join([str(tag_id), axial, tag, description]))