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


Download files

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

Files for edgedb, version 0.17.3
Filename, size File type Python version Upload date Hashes
Filename, size edgedb-0.17.3-cp36-cp36m-macosx_10_14_x86_64.whl (1.3 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size edgedb-0.17.3-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (2.9 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size edgedb-0.17.3-cp36-cp36m-win_amd64.whl (1.2 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size edgedb-0.17.3-cp37-cp37m-macosx_10_14_x86_64.whl (1.3 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size edgedb-0.17.3-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (2.9 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size edgedb-0.17.3-cp37-cp37m-win_amd64.whl (1.2 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size edgedb-0.17.3-cp38-cp38-macosx_10_14_x86_64.whl (1.3 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size edgedb-0.17.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (3.1 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size edgedb-0.17.3-cp38-cp38-win_amd64.whl (1.2 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size edgedb-0.17.3-cp39-cp39-macosx_10_14_x86_64.whl (1.3 MB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size edgedb-0.17.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (2.9 MB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size edgedb-0.17.3-cp39-cp39-win_amd64.whl (1.2 MB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size edgedb-0.17.3.tar.gz (785.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page