Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 13.4.0

* Add transaction support for Databases and TablesDB

## 13.3.0

* Deprecate `createVerification` method in `Account` service
Expand Down
4 changes: 2 additions & 2 deletions appwrite/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ def __init__(self):
self._endpoint = 'https://cloud.appwrite.io/v1'
self._global_headers = {
'content-type': '',
'user-agent' : f'AppwritePythonSDK/13.3.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
'user-agent' : f'AppwritePythonSDK/13.4.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
'x-sdk-name': 'Python',
'x-sdk-platform': 'server',
'x-sdk-language': 'python',
'x-sdk-version': '13.3.0',
'x-sdk-version': '13.4.0',
'X-Appwrite-Response-Format' : '1.8.0',
}

Expand Down
255 changes: 242 additions & 13 deletions appwrite/services/databases.py

Large diffs are not rendered by default.

253 changes: 241 additions & 12 deletions appwrite/services/tables_db.py

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion docs/examples/databases/create-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ result = databases.create_document(
"age": 30,
"isAdmin": False
},
permissions = ["read("any")"] # optional
permissions = ["read("any")"], # optional
transaction_id = '<TRANSACTION_ID>' # optional
)
3 changes: 2 additions & 1 deletion docs/examples/databases/create-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ databases = Databases(client)
result = databases.create_documents(
database_id = '<DATABASE_ID>',
collection_id = '<COLLECTION_ID>',
documents = []
documents = [],
transaction_id = '<TRANSACTION_ID>' # optional
)
24 changes: 24 additions & 0 deletions docs/examples/databases/create-operations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from appwrite.client import Client
from appwrite.services.databases import Databases

client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your secret API key

databases = Databases(client)

result = databases.create_operations(
transaction_id = '<TRANSACTION_ID>',
operations = [
{
"action": "create",
"databaseId": "<DATABASE_ID>",
"collectionId": "<COLLECTION_ID>",
"documentId": "<DOCUMENT_ID>",
"data": {
"name": "Walter O'Brien"
}
}
] # optional
)
13 changes: 13 additions & 0 deletions docs/examples/databases/create-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.databases import Databases

client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your secret API key

databases = Databases(client)

result = databases.create_transaction(
ttl = 60 # optional
)
3 changes: 2 additions & 1 deletion docs/examples/databases/decrement-document-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ result = databases.decrement_document_attribute(
document_id = '<DOCUMENT_ID>',
attribute = '',
value = None, # optional
min = None # optional
min = None, # optional
transaction_id = '<TRANSACTION_ID>' # optional
)
3 changes: 2 additions & 1 deletion docs/examples/databases/delete-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ databases = Databases(client)
result = databases.delete_document(
database_id = '<DATABASE_ID>',
collection_id = '<COLLECTION_ID>',
document_id = '<DOCUMENT_ID>'
document_id = '<DOCUMENT_ID>',
transaction_id = '<TRANSACTION_ID>' # optional
)
3 changes: 2 additions & 1 deletion docs/examples/databases/delete-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ databases = Databases(client)
result = databases.delete_documents(
database_id = '<DATABASE_ID>',
collection_id = '<COLLECTION_ID>',
queries = [] # optional
queries = [], # optional
transaction_id = '<TRANSACTION_ID>' # optional
)
13 changes: 13 additions & 0 deletions docs/examples/databases/delete-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.databases import Databases

client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your secret API key

databases = Databases(client)

result = databases.delete_transaction(
transaction_id = '<TRANSACTION_ID>'
)
3 changes: 2 additions & 1 deletion docs/examples/databases/get-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ result = databases.get_document(
database_id = '<DATABASE_ID>',
collection_id = '<COLLECTION_ID>',
document_id = '<DOCUMENT_ID>',
queries = [] # optional
queries = [], # optional
transaction_id = '<TRANSACTION_ID>' # optional
)
13 changes: 13 additions & 0 deletions docs/examples/databases/get-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.databases import Databases

client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your secret API key

databases = Databases(client)

result = databases.get_transaction(
transaction_id = '<TRANSACTION_ID>'
)
3 changes: 2 additions & 1 deletion docs/examples/databases/increment-document-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ result = databases.increment_document_attribute(
document_id = '<DOCUMENT_ID>',
attribute = '',
value = None, # optional
max = None # optional
max = None, # optional
transaction_id = '<TRANSACTION_ID>' # optional
)
3 changes: 2 additions & 1 deletion docs/examples/databases/list-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ databases = Databases(client)
result = databases.list_documents(
database_id = '<DATABASE_ID>',
collection_id = '<COLLECTION_ID>',
queries = [] # optional
queries = [], # optional
transaction_id = '<TRANSACTION_ID>' # optional
)
13 changes: 13 additions & 0 deletions docs/examples/databases/list-transactions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.databases import Databases

client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your secret API key

databases = Databases(client)

result = databases.list_transactions(
queries = [] # optional
)
3 changes: 2 additions & 1 deletion docs/examples/databases/update-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ result = databases.update_document(
collection_id = '<COLLECTION_ID>',
document_id = '<DOCUMENT_ID>',
data = {}, # optional
permissions = ["read("any")"] # optional
permissions = ["read("any")"], # optional
transaction_id = '<TRANSACTION_ID>' # optional
)
3 changes: 2 additions & 1 deletion docs/examples/databases/update-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ result = databases.update_documents(
database_id = '<DATABASE_ID>',
collection_id = '<COLLECTION_ID>',
data = {}, # optional
queries = [] # optional
queries = [], # optional
transaction_id = '<TRANSACTION_ID>' # optional
)
15 changes: 15 additions & 0 deletions docs/examples/databases/update-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from appwrite.client import Client
from appwrite.services.databases import Databases

client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your secret API key

databases = Databases(client)

result = databases.update_transaction(
transaction_id = '<TRANSACTION_ID>',
commit = False, # optional
rollback = False # optional
)
3 changes: 2 additions & 1 deletion docs/examples/databases/upsert-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ result = databases.upsert_document(
collection_id = '<COLLECTION_ID>',
document_id = '<DOCUMENT_ID>',
data = {},
permissions = ["read("any")"] # optional
permissions = ["read("any")"], # optional
transaction_id = '<TRANSACTION_ID>' # optional
)
3 changes: 2 additions & 1 deletion docs/examples/databases/upsert-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ databases = Databases(client)
result = databases.upsert_documents(
database_id = '<DATABASE_ID>',
collection_id = '<COLLECTION_ID>',
documents = []
documents = [],
transaction_id = '<TRANSACTION_ID>' # optional
)
2 changes: 1 addition & 1 deletion docs/examples/messaging/create-push.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ result = messaging.create_push(
targets = [], # optional
data = {}, # optional
action = '<ACTION>', # optional
image = '[ID1:ID2]', # optional
image = '<ID1:ID2>', # optional
icon = '<ICON>', # optional
sound = '<SOUND>', # optional
color = '<COLOR>', # optional
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/messaging/update-push.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ result = messaging.update_push(
body = '<BODY>', # optional
data = {}, # optional
action = '<ACTION>', # optional
image = '[ID1:ID2]', # optional
image = '<ID1:ID2>', # optional
icon = '<ICON>', # optional
sound = '<SOUND>', # optional
color = '<COLOR>', # optional
Expand Down
24 changes: 24 additions & 0 deletions docs/examples/tablesdb/create-operations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from appwrite.client import Client
from appwrite.services.tables_db import TablesDB

client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your secret API key

tables_db = TablesDB(client)

result = tables_db.create_operations(
transaction_id = '<TRANSACTION_ID>',
operations = [
{
"action": "create",
"databaseId": "<DATABASE_ID>",
"tableId": "<TABLE_ID>",
"rowId": "<ROW_ID>",
"data": {
"name": "Walter O'Brien"
}
}
] # optional
)
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/create-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ result = tables_db.create_row(
"age": 30,
"isAdmin": False
},
permissions = ["read("any")"] # optional
permissions = ["read("any")"], # optional
transaction_id = '<TRANSACTION_ID>' # optional
)
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/create-rows.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ tables_db = TablesDB(client)
result = tables_db.create_rows(
database_id = '<DATABASE_ID>',
table_id = '<TABLE_ID>',
rows = []
rows = [],
transaction_id = '<TRANSACTION_ID>' # optional
)
13 changes: 13 additions & 0 deletions docs/examples/tablesdb/create-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.tables_db import TablesDB

client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your secret API key

tables_db = TablesDB(client)

result = tables_db.create_transaction(
ttl = 60 # optional
)
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/decrement-row-column.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ result = tables_db.decrement_row_column(
row_id = '<ROW_ID>',
column = '',
value = None, # optional
min = None # optional
min = None, # optional
transaction_id = '<TRANSACTION_ID>' # optional
)
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/delete-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ tables_db = TablesDB(client)
result = tables_db.delete_row(
database_id = '<DATABASE_ID>',
table_id = '<TABLE_ID>',
row_id = '<ROW_ID>'
row_id = '<ROW_ID>',
transaction_id = '<TRANSACTION_ID>' # optional
)
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/delete-rows.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ tables_db = TablesDB(client)
result = tables_db.delete_rows(
database_id = '<DATABASE_ID>',
table_id = '<TABLE_ID>',
queries = [] # optional
queries = [], # optional
transaction_id = '<TRANSACTION_ID>' # optional
)
13 changes: 13 additions & 0 deletions docs/examples/tablesdb/delete-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.tables_db import TablesDB

client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your secret API key

tables_db = TablesDB(client)

result = tables_db.delete_transaction(
transaction_id = '<TRANSACTION_ID>'
)
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/get-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ result = tables_db.get_row(
database_id = '<DATABASE_ID>',
table_id = '<TABLE_ID>',
row_id = '<ROW_ID>',
queries = [] # optional
queries = [], # optional
transaction_id = '<TRANSACTION_ID>' # optional
)
13 changes: 13 additions & 0 deletions docs/examples/tablesdb/get-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.tables_db import TablesDB

client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your secret API key

tables_db = TablesDB(client)

result = tables_db.get_transaction(
transaction_id = '<TRANSACTION_ID>'
)
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/increment-row-column.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ result = tables_db.increment_row_column(
row_id = '<ROW_ID>',
column = '',
value = None, # optional
max = None # optional
max = None, # optional
transaction_id = '<TRANSACTION_ID>' # optional
)
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/list-rows.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ tables_db = TablesDB(client)
result = tables_db.list_rows(
database_id = '<DATABASE_ID>',
table_id = '<TABLE_ID>',
queries = [] # optional
queries = [], # optional
transaction_id = '<TRANSACTION_ID>' # optional
)
13 changes: 13 additions & 0 deletions docs/examples/tablesdb/list-transactions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from appwrite.client import Client
from appwrite.services.tables_db import TablesDB

client = Client()
client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
client.set_project('<YOUR_PROJECT_ID>') # Your project ID
client.set_key('<YOUR_API_KEY>') # Your secret API key

tables_db = TablesDB(client)

result = tables_db.list_transactions(
queries = [] # optional
)
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/update-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ result = tables_db.update_row(
table_id = '<TABLE_ID>',
row_id = '<ROW_ID>',
data = {}, # optional
permissions = ["read("any")"] # optional
permissions = ["read("any")"], # optional
transaction_id = '<TRANSACTION_ID>' # optional
)
3 changes: 2 additions & 1 deletion docs/examples/tablesdb/update-rows.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ result = tables_db.update_rows(
database_id = '<DATABASE_ID>',
table_id = '<TABLE_ID>',
data = {}, # optional
queries = [] # optional
queries = [], # optional
transaction_id = '<TRANSACTION_ID>' # optional
)
Loading