erioon 0.1.4__tar.gz → 0.1.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: erioon
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: Erioon Python SDK for seamless interaction with Erioon data services
5
5
  Author: Zyber Pireci
6
6
  Author-email: zyber.pireci@erioon.com
@@ -11,6 +11,7 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
+ # Visit www.erioon.com/dev-docs for more information about the python SDK
14
15
 
15
16
  from erioon.client import ErioonClient
16
17
 
@@ -11,6 +11,7 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
+ # Visit www.erioon.com/dev-docs for more information about the python SDK
14
15
 
15
16
  import requests
16
17
  from erioon.database import Database
@@ -11,6 +11,7 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
+ # Visit www.erioon.com/dev-docs for more information about the python SDK
14
15
 
15
16
  import json
16
17
  from urllib.parse import urlparse
@@ -11,7 +11,7 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
-
14
+ # Visit www.erioon.com/dev-docs for more information about the python SDK
15
15
 
16
16
  import uuid
17
17
  from erioon.functions import (
@@ -11,7 +11,7 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
-
14
+ # Visit www.erioon.com/dev-docs for more information about the python SDK
15
15
 
16
16
  import json
17
17
  from erioon.collection import Collection
@@ -11,7 +11,7 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
-
14
+ # Visit www.erioon.com/dev-docs for more information about the python SDK
15
15
 
16
16
  import json
17
17
  import io
@@ -11,7 +11,7 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
-
14
+ # Visit www.erioon.com/dev-docs for more information about the python SDK
15
15
 
16
16
  import msgpack
17
17
  from azure.storage.blob import ContainerClient
@@ -11,7 +11,7 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
-
14
+ # Visit www.erioon.com/dev-docs for more information about the python SDK
15
15
 
16
16
  from erioon.functions import async_log
17
17
  from azure.storage.blob import ContainerClient
@@ -11,7 +11,7 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
-
14
+ # Visit www.erioon.com/dev-docs for more information about the python SDK
15
15
 
16
16
  import io
17
17
  import msgpack
@@ -0,0 +1,58 @@
1
+ # Copyright 2025-present Erioon, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ # Visit www.erioon.com/dev-docs for more information about the python SDK
15
+
16
+ import uuid
17
+ from erioon.functions import get_index_data, create_msgpack_file, calculate_shard_number, async_log, update_index_file_insert
18
+
19
+ class Transaction:
20
+ def __init__(self, user_id_cont, database, collection, container_url):
21
+ self.user_id_cont = user_id_cont
22
+ self.database = database
23
+ self.collection = collection
24
+ self.container_url = container_url
25
+ self.staged_records = []
26
+
27
+ def insert_one(self, record):
28
+ if "_id" not in record or not record["_id"]:
29
+ record["_id"] = str(uuid.uuid4())
30
+ self.staged_records.append(record)
31
+
32
+ def commit(self):
33
+ # Check duplicates for all staged records
34
+ index_data = get_index_data(self.user_id_cont, self.database, self.collection, self.container_url)
35
+ existing_ids = set()
36
+ for shard in index_data:
37
+ for ids in shard.values():
38
+ existing_ids.update(ids)
39
+
40
+ # Assign new IDs if duplicates found
41
+ for record in self.staged_records:
42
+ if record["_id"] in existing_ids:
43
+ new_id = str(uuid.uuid4())
44
+ record["_id"] = new_id
45
+
46
+ # Write all records to shard files
47
+ for record in self.staged_records:
48
+ create_msgpack_file(self.user_id_cont, self.database, self.collection, record, self.container_url)
49
+ shard_number = calculate_shard_number(self.user_id_cont, self.database, self.collection, self.container_url)
50
+ update_index_file_insert(self.user_id_cont, self.database, self.collection, record["_id"], shard_number, self.container_url)
51
+
52
+ async_log(self.user_id_cont, self.database, self.collection, "POST", "SUCCESS", f"{len(self.staged_records)} records inserted atomically", len(self.staged_records), self.container_url)
53
+
54
+ self.staged_records.clear()
55
+
56
+ def rollback(self):
57
+ self.staged_records.clear()
58
+ async_log(self.user_id_cont, self.database, self.collection, "POST", "ERROR", "Transaction rollback: no records inserted", 0, self.container_url)
@@ -11,7 +11,7 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
-
14
+ # Visit www.erioon.com/dev-docs for more information about the python SDK
15
15
 
16
16
  import msgpack
17
17
  from azure.storage.blob import ContainerClient
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: erioon
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: Erioon Python SDK for seamless interaction with Erioon data services
5
5
  Author: Zyber Pireci
6
6
  Author-email: zyber.pireci@erioon.com
@@ -10,6 +10,7 @@ erioon/delete.py
10
10
  erioon/functions.py
11
11
  erioon/ping.py
12
12
  erioon/read.py
13
+ erioon/transaction.py
13
14
  erioon/update.py
14
15
  erioon.egg-info/PKG-INFO
15
16
  erioon.egg-info/SOURCES.txt
@@ -0,0 +1 @@
1
+ erioon
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='erioon',
5
- version='0.1.4',
5
+ version='0.1.6',
6
6
  author='Zyber Pireci',
7
7
  author_email='zyber.pireci@erioon.com',
8
8
  description='Erioon Python SDK for seamless interaction with Erioon data services',
@@ -21,7 +21,7 @@ setup(
21
21
  'Topic :: Software Development :: Libraries',
22
22
  'Intended Audience :: Developers',
23
23
  ],
24
- packages=find_packages(),
24
+ packages=['erioon'],
25
25
  install_requires=[
26
26
  'requests>=2.25.1',
27
27
  'pyodbc',
@@ -1 +0,0 @@
1
-
File without changes
File without changes
File without changes