GithubHelp home page GithubHelp logo

Comments (4)

bobwatcherx avatar bobwatcherx commented on June 3, 2024

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("[email protected]", "admin12345")

result = client.collection("fletSample").get_full_list()

for x in result:
print(x)

from pocketbase.

tjmuenster avatar tjmuenster commented on June 3, 2024

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.

from pocketbase.

gaetan1903 avatar gaetan1903 commented on June 3, 2024
client = PocketBase('http://127.0.0.1:8090/')

admin_data = client.admins.auth_with_password("[[email protected]](mailto:[email protected])", "admin12345")

result = client.collection("fletSample").get_full_list()

for res in result:
  print(res.__dict__)

from pocketbase.

lewisjr avatar lewisjr commented on June 3, 2024

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.

from pocketbase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.