Closed bobwatcherx closed 1 year ago
from my code here import asyncio from pocketbase import PocketBase
client = PocketBase('http://127.0.0.1:8090')
admin_data = client.admins.auth_with_password("xxxx@gmail.com", "admin12345")
result = client.collection("fletSample").get_full_list()
for x in result: print(x)
I'm not 100% sure if you can get the content of every field without knowing what fields an element of result
will contain (someone will correct me). You'd probably need to extend the class BaseModel
and add class variables for your needs (e.g. the fields in your collection in pocketbase).
For me it worked, when writing:
for x in result:
print(x.id)
Where id
can be the name of the field in your collection.
client = PocketBase('http://127.0.0.1:8090/')
admin_data = client.admins.auth_with_password("[xxxx@gmail.com](mailto:xxxx@gmail.com)", "admin12345")
result = client.collection("fletSample").get_full_list()
for res in result:
print(res.__dict__)
Figured it out, here's an example:
data = db.collection("data").get_full_list()
jsonified_data = [vars(row) for row in data]
print(jsonified_data)
Just note that if you wanted to use json.dumps to get indents on the terminal it'll return a TypeError: Object of type datetime is not JSON serializable
from the created
and updated
columns at the very least.
i want to see and display all data in collection . and output like this [<Record: 85oeuawmpqdm44y>,]
how to parse it into text