Skip to main content

Unofficial Deta client

Project description

aiodeta

Build codecov PyPI version

Unofficial client for Deta Clound

Supported functionality

  • Deta Base
  • Deta Drive
  • Decorator for cron tasks

Examples

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)
    print(resp)
    user_key = resp["key"]

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

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

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

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

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

    # Close connection
    await deta.close()

loop = asyncio.get_event_loop()
loop.run_until_complete(go())

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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file aiodeta-0.1.2.tar.gz.

File metadata

  • Download URL: aiodeta-0.1.2.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.7.7 Darwin/20.6.0

File hashes

Hashes for aiodeta-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ad1a2d747349df8ddfffab99a5cfbf09eac64cd29ec50b8ed694e9bb398ff287
MD5 b68d37c497d7f6f8f88ac781b4322131
BLAKE2b-256 35dd590c96f482153262a6becb734e5667332971a4ed7f01a54a5d2bac768639

See more details on using hashes here.

File details

Details for the file aiodeta-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: aiodeta-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.7.7 Darwin/20.6.0

File hashes

Hashes for aiodeta-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2fba299fd5c754c797a065c241254108fe7353399cd17251c1803f067812fb9b
MD5 4a2f6da6eb7e2fe232ace9623fe296df
BLAKE2b-256 e492b5c2318ea257adb249d3e1c93107a7337ac3621b7df1ebbdd30c8825dd0a

See more details on using hashes here.

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