thds.core 1.46.20251010161748__py3-none-any.whl → 1.46.20251014213634__py3-none-any.whl
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.
Potentially problematic release.
This version of thds.core might be problematic. Click here for more details.
- thds/core/sqlite/index.py +11 -7
- {thds_core-1.46.20251010161748.dist-info → thds_core-1.46.20251014213634.dist-info}/METADATA +1 -1
- {thds_core-1.46.20251010161748.dist-info → thds_core-1.46.20251014213634.dist-info}/RECORD +6 -6
- {thds_core-1.46.20251010161748.dist-info → thds_core-1.46.20251014213634.dist-info}/WHEEL +0 -0
- {thds_core-1.46.20251010161748.dist-info → thds_core-1.46.20251014213634.dist-info}/entry_points.txt +0 -0
- {thds_core-1.46.20251010161748.dist-info → thds_core-1.46.20251014213634.dist-info}/top_level.txt +0 -0
thds/core/sqlite/index.py
CHANGED
|
@@ -4,19 +4,23 @@ from .connect import Connectable, autoconn_scope, autoconnect
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
@autoconn_scope.bound
|
|
7
|
-
def create(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"""Create an index on a table in a SQLite database using only sqlite3 and SQL.
|
|
7
|
+
def create(
|
|
8
|
+
connectable: Connectable, table_name: str, columns: ty.Collection[str], unique: bool = False
|
|
9
|
+
) -> str:
|
|
10
|
+
"""Create an index on a table in a SQLite database using only sqlite3 and SQL.
|
|
11
|
+
|
|
12
|
+
Is idempotent, but does not verify that your index DDL matches what you're asking for."""
|
|
11
13
|
colnames = "_".join(colname for colname in columns).replace("-", "_")
|
|
14
|
+
idx_name = f"idx_{table_name}__{colnames}"
|
|
12
15
|
|
|
13
16
|
sql_create_index = (
|
|
14
17
|
f"CREATE {'UNIQUE' if unique else ''} INDEX IF NOT EXISTS "
|
|
15
|
-
f"[{
|
|
18
|
+
f"[{idx_name}] ON [{table_name}] ({', '.join(columns)})"
|
|
16
19
|
)
|
|
17
20
|
try:
|
|
18
|
-
|
|
21
|
+
autoconnect(connectable).execute(sql_create_index)
|
|
19
22
|
# do not commit - let the caller decide when to commit, or allow autoconnect to do its job
|
|
23
|
+
return idx_name
|
|
20
24
|
except Exception:
|
|
21
|
-
print(sql_create_index)
|
|
25
|
+
print("FAILURE TO CREATE INDEX: " + sql_create_index)
|
|
22
26
|
raise
|
|
@@ -64,7 +64,7 @@ thds/core/sqlite/connect.py,sha256=l4QaSAI8RjP7Qh2FjmJ3EwRgfGf65Z3-LjtC9ocHM_U,9
|
|
|
64
64
|
thds/core/sqlite/copy.py,sha256=y3IRQTBrWDfKuVIfW7fYuEgwRCRKHjN0rxVFkIb9VrQ,1155
|
|
65
65
|
thds/core/sqlite/ddl.py,sha256=k9BvmDzb0rrlhmEpXkB6ESaZAUWtbL58x-70sPyoFk4,201
|
|
66
66
|
thds/core/sqlite/functions.py,sha256=AOIRzb7lNxmFm1J5JS6R8Nl-dSv3Dy47UNZVVjl1rvk,2158
|
|
67
|
-
thds/core/sqlite/index.py,sha256=
|
|
67
|
+
thds/core/sqlite/index.py,sha256=cd-pxhb2lN2kG3ypp4hRnWSYbdLGM8Gb95PvHIjI41U,979
|
|
68
68
|
thds/core/sqlite/insert_utils.py,sha256=BNI3VUdqwBdaqa0xqiJrhE6XyzPsTF8N4KKKdb4Vfes,884
|
|
69
69
|
thds/core/sqlite/merge.py,sha256=NxettDMJ_mcrWfteQn_ERY7MUB5ETR-yJLKg7uvF6zA,3779
|
|
70
70
|
thds/core/sqlite/meta.py,sha256=8Gh4FhTzU86FK8oWosoyPfT0EVd-kfieThEQBrD-l30,7299
|
|
@@ -74,8 +74,8 @@ thds/core/sqlite/structured.py,sha256=8t1B6XbM5NnudKEeBLsdjRVbSXXSr6iHOW0HwEAqtX
|
|
|
74
74
|
thds/core/sqlite/types.py,sha256=oq8m0UrvSn1IqWWcQ4FPptfAhdj6DllnCe7puVqSHlY,1297
|
|
75
75
|
thds/core/sqlite/upsert.py,sha256=BmKK6fsGVedt43iY-Lp7dnAu8aJ1e9CYlPVEQR2pMj4,5827
|
|
76
76
|
thds/core/sqlite/write.py,sha256=z0219vDkQDCnsV0WLvsj94keItr7H4j7Y_evbcoBrWU,3458
|
|
77
|
-
thds_core-1.46.
|
|
78
|
-
thds_core-1.46.
|
|
79
|
-
thds_core-1.46.
|
|
80
|
-
thds_core-1.46.
|
|
81
|
-
thds_core-1.46.
|
|
77
|
+
thds_core-1.46.20251014213634.dist-info/METADATA,sha256=2oTaH0wYExZDblfBiSmN3vbCzFijngODJW0BjYVUXqk,2216
|
|
78
|
+
thds_core-1.46.20251014213634.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
79
|
+
thds_core-1.46.20251014213634.dist-info/entry_points.txt,sha256=bOCOVhKZv7azF3FvaWX6uxE6yrjK6FcjqhtxXvLiFY8,161
|
|
80
|
+
thds_core-1.46.20251014213634.dist-info/top_level.txt,sha256=LTZaE5SkWJwv9bwOlMbIhiS-JWQEEIcjVYnJrt-CriY,5
|
|
81
|
+
thds_core-1.46.20251014213634.dist-info/RECORD,,
|
|
File without changes
|
{thds_core-1.46.20251010161748.dist-info → thds_core-1.46.20251014213634.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{thds_core-1.46.20251010161748.dist-info → thds_core-1.46.20251014213634.dist-info}/top_level.txt
RENAMED
|
File without changes
|