Skip to main content

Unofficial Deta client

Project description


Build codecov PyPI version

Unofficial client for Deta Clound

Supported functionality

  • Deta Base
  • Deta Drive
  • Decorator for cron tasks


import asyncio
from aiodeta import Deta

DETA_PROJECT_KEY = "xxx_yyy"

async def go():
    db_name = "users"

    # Initialize Deta client
    deta = Deta(DETA_PROJECT_KEY)

    # Initialize Deta Base client
    base = deta.Base(db_name)

    # Create row in Deta Base
    user = {"username": "steve", "active": False}
    resp = await base.insert(user)
    user_key = resp["key"]

    # Update row by key
    resp = await base.update(user_key, set={"active": True})

    # Get row by key
    resp = await base.get(user_key)

    # Delete row by key
    resp = await base.delete(user_key)

    # Create multiple rows in one request
    users = [
        {"username": "jeff", "active": True},
        {"username": "rob", "active": False},
        {"username": "joe", "active": True}
    resp = await base.put(users)

    # Query data
    query = [{"active": True}, {"username?pfx": "j"}]
    result = await base.query(query=query, limit=10)

    # Close connection
    await deta.close()

loop = asyncio.get_event_loop()

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiodeta-0.1.2.tar.gz (3.7 kB view hashes)

Uploaded source

Built Distribution

aiodeta-0.1.2-py3-none-any.whl (3.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page