Back

Retrieve documents in python

  • 0
  • Databases
  • Functions
mitsy0_0
4 Jun, 2023, 11:22

Hey I have a little confusion I want to retrieve documents and do computations in my python function, but there is no python syntax given in docs

TL;DR
The user wants to retrieve documents using Python in Appwrite. They found an example code on GitHub and some examples in other languages on the Appwrite documentation, but they can't find a Python syntax example. They ask how to add queries in Python and mention that they can't find an 'import queries' statement. Another user suggests checking the server-side documentation for the Python SDK. The user expresses confusion about how to retrieve documents and perform computations in their Python function without a Python syntax example in the docs. Solution: The user can refer to the server-side documentation for the Python SDK to find the correct syntax for retrieving documents and performing computations in
D5
4 Jun, 2023, 11:24

Python is server-sided (or at least in most cases), so you should refer to the python sdk docs: https://appwrite.io/docs/server/databases?sdk=python-default

D5
4 Jun, 2023, 11:26

Basically there is a tab that lets you to swith in docs between both client and server side. You click server tab and then you will be able to see python SDK

mitsy0_0
4 Jun, 2023, 13:39

I'm sorry, How can I add queries in python? I can't even find the import queries statement😕

Binyamin
4 Jun, 2023, 15:57

Actualy there aren't any python example for Appwrite queries. But, take a look in this code for example. https://github.com/Foxtrt-com/Foxbot/blob/3d79c2a3be796a413444ee4cff38fc246adeca7b/main/helpers/appwrite.py#L114

In general, it's what you see in other langauges here: https://appwrite.io/docs/queries

But, For python

TypeScript
from appwrite.query import Query

databases.list_documents(database_id='DB_ID', collection_id='COLLECTION_ID',
                                     queries=[Query.orderDesc('exp'), Query.limit(5)])
mitsy0_0
4 Jun, 2023, 16:41

Ok, thank you

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more