linkarchivetools 0.1.15__tar.gz → 0.1.17__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (18) hide show
  1. {linkarchivetools-0.1.15 → linkarchivetools-0.1.17}/PKG-INFO +1 -1
  2. {linkarchivetools-0.1.15 → linkarchivetools-0.1.17}/linkarchivetools/dbfilter.py +11 -5
  3. {linkarchivetools-0.1.15 → linkarchivetools-0.1.17}/linkarchivetools/utils/reflected.py +10 -0
  4. {linkarchivetools-0.1.15 → linkarchivetools-0.1.17}/pyproject.toml +1 -1
  5. {linkarchivetools-0.1.15 → linkarchivetools-0.1.17}/LICENSE +0 -0
  6. {linkarchivetools-0.1.15 → linkarchivetools-0.1.17}/README.md +0 -0
  7. {linkarchivetools-0.1.15 → linkarchivetools-0.1.17}/linkarchivetools/LICENSE +0 -0
  8. {linkarchivetools-0.1.15 → linkarchivetools-0.1.17}/linkarchivetools/README.md +0 -0
  9. {linkarchivetools-0.1.15 → linkarchivetools-0.1.17}/linkarchivetools/__init__.py +0 -0
  10. {linkarchivetools-0.1.15 → linkarchivetools-0.1.17}/linkarchivetools/backup.py +0 -0
  11. {linkarchivetools-0.1.15 → linkarchivetools-0.1.17}/linkarchivetools/db2feeds.py +0 -0
  12. {linkarchivetools-0.1.15 → linkarchivetools-0.1.17}/linkarchivetools/db2json.py +0 -0
  13. {linkarchivetools-0.1.15 → linkarchivetools-0.1.17}/linkarchivetools/dbanalyzer.py +0 -0
  14. {linkarchivetools-0.1.15 → linkarchivetools-0.1.17}/linkarchivetools/dbmerge.py +0 -0
  15. {linkarchivetools-0.1.15 → linkarchivetools-0.1.17}/linkarchivetools/json2db.py +0 -0
  16. {linkarchivetools-0.1.15 → linkarchivetools-0.1.17}/linkarchivetools/tableconfig.py +0 -0
  17. {linkarchivetools-0.1.15 → linkarchivetools-0.1.17}/linkarchivetools/utils/alchemysearch.py +0 -0
  18. {linkarchivetools-0.1.15 → linkarchivetools-0.1.17}/linkarchivetools/utils/omnisearch.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: linkarchivetools
3
- Version: 0.1.15
3
+ Version: 0.1.17
4
4
  Summary: Link Archive Tools
5
5
  License: GPL3
6
6
  Author: Iwan Grozny
@@ -13,6 +13,7 @@ import argparse
13
13
 
14
14
  from sqlalchemy import create_engine
15
15
  from .utils.reflected import *
16
+ from .tableconfig import get_tables
16
17
 
17
18
 
18
19
  class DbFilter(object):
@@ -53,7 +54,12 @@ class DbFilter(object):
53
54
  self.connection = None
54
55
 
55
56
  def truncate(self):
56
- table = ReflectedEntryTable(self.engine, self.connection)
57
+ """
58
+ TODO remove these hardcoded tables
59
+ with something from table_config
60
+ though it seems it should not clear linkdatamodel
61
+ """
62
+ table = ReflectedTable(self.engine, self.connection)
57
63
 
58
64
  table.truncate_table("userentrytransitionhistory")
59
65
  table.truncate_table("userentryvisithistory")
@@ -78,7 +84,7 @@ class DbFilter(object):
78
84
  table.truncate_table("blockentrylist")
79
85
 
80
86
  def filter(self, conditions):
81
- table = ReflectedEntryTable(self.engine, self.connection)
87
+ table = ReflectedTable(self.engine, self.connection)
82
88
 
83
89
  sql_text = f"DELETE FROM linkdatamodel WHERE {conditions};"
84
90
  # TODO delete depnded things
@@ -87,7 +93,7 @@ class DbFilter(object):
87
93
  table.close()
88
94
 
89
95
  def filter_bookmarks(self):
90
- table = ReflectedEntryTable(self.engine, self.connection)
96
+ table = ReflectedTable(self.engine, self.connection)
91
97
 
92
98
  sql_text = f"DELETE FROM linkdatamodel WHERE bookmarked=False;"
93
99
  # TODO delete depnded things
@@ -96,7 +102,7 @@ class DbFilter(object):
96
102
  table.close()
97
103
 
98
104
  def filter_votes(self):
99
- table = ReflectedEntryTable(self.engine, self.connection)
105
+ table = ReflectedTable(self.engine, self.connection)
100
106
 
101
107
  sql_text = f"DELETE FROM linkdatamodel WHERE page_rating_votes=0;"
102
108
  table.run_sql(sql_text)
@@ -107,7 +113,7 @@ class DbFilter(object):
107
113
  """
108
114
  Not bookmarked AND without votes are redundant
109
115
  """
110
- table = ReflectedEntryTable(self.engine, self.connection)
116
+ table = ReflectedTable(self.engine, self.connection)
111
117
 
112
118
  sql_text = f"DELETE FROM linkdatamodel WHERE bookmarked=False AND page_rating_votes=0;"
113
119
  table.run_sql(sql_text)
@@ -42,6 +42,11 @@ class ReflectedTable(object):
42
42
 
43
43
  index.create(bind=self.engine)
44
44
 
45
+ def enable_sqlite_wal(self, table_name):
46
+ sql_text = f"PRAGMA journal_mode=WAL;"
47
+ self.connection.execute(text(sql_text))
48
+ self.connection.commit()
49
+
45
50
  def vacuum(self):
46
51
  self.connection.execute(text("VACUUM"))
47
52
 
@@ -129,6 +134,11 @@ class ReflectedGenericTable(object):
129
134
  self.connection.execute(text(sql_text))
130
135
  self.connection.commit()
131
136
 
137
+ def enable_sqlite_wal(self):
138
+ sql_text = f"PRAGMA journal_mode=WAL;"
139
+ self.connection.execute(text(sql_text))
140
+ self.connection.commit()
141
+
132
142
  def create_index(self, column_name):
133
143
  index_name = f"idx_{self.table.name}_{column_name}"
134
144
  index = Index(index_name, getattr(table.c, column_name))
@@ -3,7 +3,7 @@
3
3
 
4
4
  [tool.poetry]
5
5
  name = "linkarchivetools"
6
- version = "0.1.15"
6
+ version = "0.1.17"
7
7
  description = "Link Archive Tools"
8
8
  authors = ["Iwan Grozny <renegat@renegat0x0.ddns.net>"]
9
9
  license = "GPL3"