summaryrefslogtreecommitdiff
path: root/bjoern/videoanalyse
diff options
context:
space:
mode:
authorareyoumee <ayumilara.bischoff@stud.tu-darmstadt.de>2023-06-15 13:42:07 +0200
committerareyoumee <ayumilara.bischoff@stud.tu-darmstadt.de>2023-06-15 13:42:07 +0200
commite16826dcbb7fc6036de5fc1ad50f74e4e695ac00 (patch)
treea954742e4b47f5c59ec45c138f743d2d3dbe5cbd /bjoern/videoanalyse
parent282bf64e8b28146377a3d1e0d1b2cd723a572368 (diff)
add script for reading sqlite
Diffstat (limited to 'bjoern/videoanalyse')
-rw-r--r--bjoern/videoanalyse/read_sqlite.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/bjoern/videoanalyse/read_sqlite.py b/bjoern/videoanalyse/read_sqlite.py
new file mode 100644
index 0000000..2041ac3
--- /dev/null
+++ b/bjoern/videoanalyse/read_sqlite.py
@@ -0,0 +1,32 @@
+import sqlite3;
+import fileinput;
+import csv;
+
+def print_sqlite(cursor):
+ for row in cursor.fetchall():
+ print(dict(row))
+
+def create_csv_from_sqlite(data):
+ with open('sqlite_output.csv', 'w', newline='') as f:
+ writer = csv.writer(f)
+ writer.writerow(['id', 'url', ...])
+ writer.writerows(data)
+
+def get_url_from_sqlite(sqlite_file, title):
+ con = sqlite3.connect(sqlite_file)
+ con.row_factory = sqlite3.Row
+
+ cur = con.cursor()
+ select_statement = 'SELECT url FROM moz_places WHERE title = ?'
+ dat = cur.execute(select_statement, (title,))
+
+ print_sqlite(cur)
+
+def main():
+ get_url_from_sqlite('chsokl11/places.sqlite', 'Atmosphärische Gegenstrahlung – Wikipedia')
+
+ #create_csv_from_sqlite(dat)
+ #concat_logfiles()
+
+if __name__ == "__main__":
+ main()