Skip to content

Commit 726cb32

Browse files
authored
Merge pull request #120 from appwrite/dev
feat: Python SDK update for version 13.4.0
2 parents e127062 + a09cbba commit 726cb32

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+723
-55
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## 13.4.0
4+
5+
* Add transaction support for Databases and TablesDB
6+
37
## 13.3.0
48

59
* Deprecate `createVerification` method in `Account` service

appwrite/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ def __init__(self):
1515
self._endpoint = 'https://cloud.appwrite.io/v1'
1616
self._global_headers = {
1717
'content-type': '',
18-
'user-agent' : f'AppwritePythonSDK/13.3.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
18+
'user-agent' : f'AppwritePythonSDK/13.4.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
1919
'x-sdk-name': 'Python',
2020
'x-sdk-platform': 'server',
2121
'x-sdk-language': 'python',
22-
'x-sdk-version': '13.3.0',
22+
'x-sdk-version': '13.4.0',
2323
'X-Appwrite-Response-Format' : '1.8.0',
2424
}
2525

appwrite/services/databases.py

Lines changed: 242 additions & 13 deletions
Large diffs are not rendered by default.

appwrite/services/tables_db.py

Lines changed: 241 additions & 12 deletions
Large diffs are not rendered by default.

docs/examples/databases/create-document.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ result = databases.create_document(
1919
"age": 30,
2020
"isAdmin": False
2121
},
22-
permissions = ["read("any")"] # optional
22+
permissions = ["read("any")"], # optional
23+
transaction_id = '<TRANSACTION_ID>' # optional
2324
)

docs/examples/databases/create-documents.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ databases = Databases(client)
1111
result = databases.create_documents(
1212
database_id = '<DATABASE_ID>',
1313
collection_id = '<COLLECTION_ID>',
14-
documents = []
14+
documents = [],
15+
transaction_id = '<TRANSACTION_ID>' # optional
1516
)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from appwrite.client import Client
2+
from appwrite.services.databases import Databases
3+
4+
client = Client()
5+
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
6+
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
7+
client.set_key('<YOUR_API_KEY>') # Your secret API key
8+
9+
databases = Databases(client)
10+
11+
result = databases.create_operations(
12+
transaction_id = '<TRANSACTION_ID>',
13+
operations = [
14+
{
15+
"action": "create",
16+
"databaseId": "<DATABASE_ID>",
17+
"collectionId": "<COLLECTION_ID>",
18+
"documentId": "<DOCUMENT_ID>",
19+
"data": {
20+
"name": "Walter O'Brien"
21+
}
22+
}
23+
] # optional
24+
)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from appwrite.client import Client
2+
from appwrite.services.databases import Databases
3+
4+
client = Client()
5+
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
6+
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
7+
client.set_key('<YOUR_API_KEY>') # Your secret API key
8+
9+
databases = Databases(client)
10+
11+
result = databases.create_transaction(
12+
ttl = 60 # optional
13+
)

docs/examples/databases/decrement-document-attribute.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ result = databases.decrement_document_attribute(
1414
document_id = '<DOCUMENT_ID>',
1515
attribute = '',
1616
value = None, # optional
17-
min = None # optional
17+
min = None, # optional
18+
transaction_id = '<TRANSACTION_ID>' # optional
1819
)

docs/examples/databases/delete-document.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ databases = Databases(client)
1111
result = databases.delete_document(
1212
database_id = '<DATABASE_ID>',
1313
collection_id = '<COLLECTION_ID>',
14-
document_id = '<DOCUMENT_ID>'
14+
document_id = '<DOCUMENT_ID>',
15+
transaction_id = '<TRANSACTION_ID>' # optional
1516
)

0 commit comments

Comments
 (0)