Skip to main content

EdgeDB Python driver

Project description

https://github.com/edgedb/edgedb-python/workflows/Tests/badge.svg?event=push&branch=master https://img.shields.io/pypi/v/edgedb.svg https://img.shields.io/badge/join-github%20discussions-green

edgedb-python is the official EdgeDB driver for Python. It provides both blocking IO and asyncio implementations.

The library requires Python 3.6 or later.

Documentation

The project documentation can be found here.

Installation

The library is available on PyPI. Use pip to install it:

$ pip install edgedb

Basic Usage

import datetime
import edgedb

def main():
    # Establish a connection to an existing database named "test"
    # as an "edgedb" user.
    conn = edgedb.connect('edgedb://edgedb@localhost/test')
    # Create a User object type
    conn.execute('''
        CREATE TYPE User {
            CREATE REQUIRED PROPERTY name -> str;
            CREATE PROPERTY dob -> cal::local_date;
        }
    ''')

    # Insert a new User object
    conn.query('''
        INSERT User {
            name := <str>$name,
            dob := <cal::local_date>$dob
        }
    ''', name='Bob', dob=datetime.date(1984, 3, 1))

    # Select User objects.
    user_set = conn.query(
        'SELECT User {name, dob} FILTER .name = <str>$name', name='Bob')
    # *user_set* now contains
    # Set{Object{name := 'Bob', dob := datetime.date(1984, 3, 1)}}

    # Close the connection.
    conn.close()

if __name__ == '__main__':
    main()

Development

Instructions for installing EdgeDB and edgedb-python locally can be found at edgedb.com/docs/internals/dev/.

To run the test suite, run $ python setup.py test.

License

edgedb-python is developed and distributed under the Apache 2.0 license.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

edgedb-0.12.0.tar.gz (752.6 kB view hashes)

Uploaded Source

Built Distributions

edgedb-0.12.0-cp38-cp38-win_amd64.whl (1.2 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

edgedb-0.12.0-cp38-cp38-manylinux1_x86_64.whl (3.0 MB view hashes)

Uploaded CPython 3.8

edgedb-0.12.0-cp38-cp38-macosx_10_14_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.8 macOS 10.14+ x86-64

edgedb-0.12.0-cp37-cp37m-win_amd64.whl (1.2 MB view hashes)

Uploaded CPython 3.7m Windows x86-64

edgedb-0.12.0-cp37-cp37m-manylinux1_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.7m

edgedb-0.12.0-cp37-cp37m-macosx_10_14_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.7m macOS 10.14+ x86-64

edgedb-0.12.0-cp36-cp36m-win_amd64.whl (1.2 MB view hashes)

Uploaded CPython 3.6m Windows x86-64

edgedb-0.12.0-cp36-cp36m-manylinux1_x86_64.whl (2.9 MB view hashes)

Uploaded CPython 3.6m

edgedb-0.12.0-cp36-cp36m-macosx_10_14_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.6m macOS 10.14+ x86-64

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