kodexa 7.4.412416252968__py3-none-any.whl → 7.4.412417009064__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.
- kodexa/model/persistence.py +5 -5
- kodexa/platform/client.py +7 -2
- {kodexa-7.4.412416252968.dist-info → kodexa-7.4.412417009064.dist-info}/METADATA +1 -1
- {kodexa-7.4.412416252968.dist-info → kodexa-7.4.412417009064.dist-info}/RECORD +6 -6
- {kodexa-7.4.412416252968.dist-info → kodexa-7.4.412417009064.dist-info}/LICENSE +0 -0
- {kodexa-7.4.412416252968.dist-info → kodexa-7.4.412417009064.dist-info}/WHEEL +0 -0
kodexa/model/persistence.py
CHANGED
@@ -1243,18 +1243,18 @@ class SqliteDocumentPersistence(object):
|
|
1243
1243
|
Ensure the 'ed' table exists in the database.
|
1244
1244
|
Creates the table if it does not exist.
|
1245
1245
|
"""
|
1246
|
-
# First check if the old table exists and has
|
1246
|
+
# First check if the old table exists and has key column
|
1247
1247
|
old_table = self.cursor.execute("""
|
1248
1248
|
SELECT name FROM sqlite_master
|
1249
1249
|
WHERE type='table' AND name='ed'
|
1250
1250
|
""").fetchone()
|
1251
1251
|
|
1252
1252
|
if old_table:
|
1253
|
-
# Check if table has
|
1253
|
+
# Check if table has key column
|
1254
1254
|
table_info = self.cursor.execute("PRAGMA table_info(ed)").fetchall()
|
1255
|
-
|
1255
|
+
has_key_column = any(col[1] == 'key' for col in table_info)
|
1256
1256
|
|
1257
|
-
if
|
1257
|
+
if not has_key_column:
|
1258
1258
|
# Get the old data and drop the table
|
1259
1259
|
data = self.cursor.execute("SELECT obj FROM ed").fetchone()
|
1260
1260
|
self.cursor.execute("DROP TABLE ed")
|
@@ -1272,7 +1272,7 @@ class SqliteDocumentPersistence(object):
|
|
1272
1272
|
self.cursor.execute("INSERT INTO ed (key, obj) VALUES (?, ?)",
|
1273
1273
|
["default", data[0]])
|
1274
1274
|
else:
|
1275
|
-
# Table exists
|
1275
|
+
# Table exists and has key column - do nothing
|
1276
1276
|
return
|
1277
1277
|
else:
|
1278
1278
|
# Create new table if it doesn't exist
|
kodexa/platform/client.py
CHANGED
@@ -5428,6 +5428,7 @@ class DocumentStoreEndpoint(StoreEndpoint):
|
|
5428
5428
|
replace=False,
|
5429
5429
|
additional_metadata: Optional[dict] = None,
|
5430
5430
|
external_data: Optional[dict] = None,
|
5431
|
+
document: Optional[Document] = None,
|
5431
5432
|
):
|
5432
5433
|
"""
|
5433
5434
|
Upload a file to the store.
|
@@ -5438,6 +5439,7 @@ class DocumentStoreEndpoint(StoreEndpoint):
|
|
5438
5439
|
replace (bool): Replace the file if it already exists (Default False).
|
5439
5440
|
additional_metadata (Optional[dict]): Additional metadata to add to the file (Default None).
|
5440
5441
|
external_data (Optional[dict]): External data to add to the file (Default None).
|
5442
|
+
document (Optional[Document]): The document to add to the file (Default None).
|
5441
5443
|
"""
|
5442
5444
|
if Path(file_path).is_file():
|
5443
5445
|
logger.info(f"Uploading {file_path}")
|
@@ -5447,7 +5449,8 @@ class DocumentStoreEndpoint(StoreEndpoint):
|
|
5447
5449
|
content=path_content,
|
5448
5450
|
replace=replace,
|
5449
5451
|
additional_metadata=additional_metadata,
|
5450
|
-
external_data=external_data
|
5452
|
+
external_data=external_data,
|
5453
|
+
document=document,
|
5451
5454
|
)
|
5452
5455
|
else:
|
5453
5456
|
raise Exception(f"{file_path} is not a file")
|
@@ -5459,6 +5462,7 @@ class DocumentStoreEndpoint(StoreEndpoint):
|
|
5459
5462
|
replace=False,
|
5460
5463
|
additional_metadata: Optional[dict] = None,
|
5461
5464
|
external_data: Optional[dict] = None,
|
5465
|
+
document: Optional[Document] = None,
|
5462
5466
|
) -> DocumentFamilyEndpoint:
|
5463
5467
|
"""
|
5464
5468
|
Put the content into the store at the given path.
|
@@ -5469,11 +5473,12 @@ class DocumentStoreEndpoint(StoreEndpoint):
|
|
5469
5473
|
replace (bool): Replace the content if it exists.
|
5470
5474
|
additional_metadata (Optional[dict]): Additional metadata to store with the document (not it can't include 'path').
|
5471
5475
|
external_data (Optional[dict]): External data to store with the document.
|
5476
|
+
document (Optional[Document]): The document to store with the content.
|
5472
5477
|
|
5473
5478
|
Returns:
|
5474
5479
|
DocumentFamilyEndpoint: The document family that was created.
|
5475
5480
|
"""
|
5476
|
-
files = {"file": content}
|
5481
|
+
files = {"file": content, "document": document.to_kddb()} if document else {"file": content}
|
5477
5482
|
|
5478
5483
|
if additional_metadata is None:
|
5479
5484
|
additional_metadata = {}
|
@@ -13,12 +13,12 @@ kodexa/model/entities/product.py,sha256=ZDpHuBE_9FJ-klnkyBvTfPwYOqBkM1wraZMtHqNA
|
|
13
13
|
kodexa/model/entities/product_subscription.py,sha256=UcmWR-qgLfdV7VCtJNwzgkanoS8nBSL6ngVuxQUK1M8,3810
|
14
14
|
kodexa/model/model.py,sha256=qh1YUew3UgtjU0t4fAwSXYYuzQjXTOZWZkafyFp_w8M,118801
|
15
15
|
kodexa/model/objects.py,sha256=4Oyjs6omlHfwziAK1m2tFk4jSnzN7lFdXACog07ed1c,185124
|
16
|
-
kodexa/model/persistence.py,sha256=
|
16
|
+
kodexa/model/persistence.py,sha256=HX_uIkGs8bqHwqyE5wB2qMlGIG5ZnjuTu7xMdvKhEzA,72033
|
17
17
|
kodexa/model/utils.py,sha256=6R-3rFiW9irBwj0Mq5yhp7EDXkNUFaeFhr3bWmnlW4g,2961
|
18
18
|
kodexa/pipeline/__init__.py,sha256=sA7f5D6qkdMrpp2xTIeefnrUBI6xxEEWostvxfX_1Cs,236
|
19
19
|
kodexa/pipeline/pipeline.py,sha256=ZYpJAWcwV4YRK589DUhU0vXGQlkNSj4J2TsGbYqTLjo,25221
|
20
20
|
kodexa/platform/__init__.py,sha256=1O3oiWMg292NPL_NacKDnK1T3_R6cMorrPRue_9e-O4,216
|
21
|
-
kodexa/platform/client.py,sha256=
|
21
|
+
kodexa/platform/client.py,sha256=V-LAiT6PmbZ_6oKhMGnxJc2lJlOGgVH12g_vUJxVsiY,226970
|
22
22
|
kodexa/platform/interaction.py,sha256=6zpcwXKNZstUGNS6m4JsoRXAqCZPJHWI-ZN3co8nnF0,1055
|
23
23
|
kodexa/platform/kodexa.py,sha256=tPXHO500q3S75GhKGDcaxO51Viq2PNlHmAzpBZlahgo,34857
|
24
24
|
kodexa/selectors/__init__.py,sha256=xA9-4vpyaAZWPSk3bh2kvDLkdv6XEmm7PjFbpziiTIk,100
|
@@ -43,7 +43,7 @@ kodexa/testing/test_utils.py,sha256=v44p__gE7ia67W7WeHN2HBFCWSCUrCZt7G4xBNCmwf8,
|
|
43
43
|
kodexa/training/__init__.py,sha256=xs2L62YpRkIRfslQwtQZ5Yxjhm7sLzX2TrVX6EuBnZQ,52
|
44
44
|
kodexa/training/train_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
45
45
|
kodexa/utils/__init__.py,sha256=Pnim1o9_db5YEnNvDTxpM7HG-qTlL6n8JwFwOafU9wo,5928
|
46
|
-
kodexa-7.4.
|
47
|
-
kodexa-7.4.
|
48
|
-
kodexa-7.4.
|
49
|
-
kodexa-7.4.
|
46
|
+
kodexa-7.4.412417009064.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
47
|
+
kodexa-7.4.412417009064.dist-info/METADATA,sha256=spL5KbmrGX7hjYXox8ofTL_tGW0u7qicBPpQGox5St0,3528
|
48
|
+
kodexa-7.4.412417009064.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
49
|
+
kodexa-7.4.412417009064.dist-info/RECORD,,
|
File without changes
|
File without changes
|