Edgedb Python Versions Save

The official Python client library for EdgeDB

v0.18.0

1 year ago

Changes

  • support protocol version 0.12 (by @fmoor in 5ce52ed8)

  • Update to protocol version 0.13 (by @1st1 in c690250, 8by @fmoor in 5ce52ed8, by @jaclarke in a5a6218d for #253)

  • Lookup edgedb.toml recursively in parent directories (by @fmoor in d9a12b88 for #245)

  • Update connection parameter resolution (by @jaclarke in 085f5748 for #241)

  • Implement EDGEDB_CLIENT_SECURITY (by @fmoor in ac46c374)

  • Add optional/required query_single* methods + rename retrying_transaction + update pool to create_client API (by @jaclarke in f2ae0d0e for #249)

Deprecations

  • Deprecate Pool.acquire() and Pool.release() (by @fmoor in 2d501e97 for #217)

  • Rename tls_verify_hostname to tls_security (by @fmoor in 2086b866)

Fixes

  • Do not attempt to del transport in connection_lost if it has been already (by @elprans in c719e79b for #215)

  • Retry if start() raises a retryable error (#228) (by @fantix in ffaae01a for #228)

  • Fix broken pool connection cleanup (by @fantix in be449591 for #222)

  • Fix deprecated usage of SSLContext (#231) (by @elprans in f73f9999 for #231)

  • Bugfix: _borrowed_for is now set entering a transaction (#233) (by @fantix in bf763d1d for #233)

  • Send zero arguments as zero-length bytes in proto 0.12 (#238) (by @tailhook in f51dd514 for #238)

  • Fix retrying_transaction() on network errors (by @fmoor in cc001e62)

  • Fix connection and retry options on AsyncIOPool (#237) (by @tailhook in 44e279f4 for #237)

  • Auto retry read-only queries outside transactions (#243) (by @fmoor in 76bb5865 for #243)

  • Fix credentials_file argument typo on async_connect (#252) (by @mkniewallner in b21b70ae for #252)

v0.22.0

1 year ago

Changes

  • Implementation refactor for Client-based interface (by @fantix in 33175f1b for #286)

v1.0.0

1 year ago

This is the v1.0 release for the edgedb-python client library. It is accompanied by the introduction of a new module edgedb.codegen which can be executed to generate code from .edgeql files.

Breaking Changes

Query Result Type Changes

#366

  1. In edgedb-python 1.0, we dropped many custom data structure implementations, and replaced them with Python builtins:

    Impl Dropped Replacement Breaking Changes
    edgedb.Tuple tuple weakref.ref() will stop working on tuples
    edgedb.Set list * Immutability is broken
    * weakref.ref() will stop working on sets
    * hash() will stop working on sets
    * repr() produces different results
    edgedb.Array list * Immutability is broken
    * weakref.ref() will stop working on lists
    * hash() will stop working on lists

    While the implementations are dropped, the reference name is still there, like edgedb.Tuple is simply an alias of the builtin tuple.

  2. edgedb.NamedTuple is reimplemented.

    • [Breaking Change] weakref.ref() will stop working on named tuples.
    • edgedb.NamedTuple is now a subclass of Python builtin tuple.
    • Before named tuple instances are created, a transient heap type DerivedNamedTuple will be created first as a subclass of edgedb.NamedTuple, which is then used to create instances with naming data.
    • DerivedNamedTuple classes are usually cached in codecs, and garbage-collected when all its references are cleared.
  3. edgedb.EnumValue is reimplemented.

    • [Breaking Change] The result of repr() is slightly changed to have the edgedb. prefix.
    • edgedb.EnumValue is now a subclass of Python builtin enum.Enum.
    • Before enum values are created, a transient heap type DerivedEnumValue will be created first as a subclass of edgedb.EnumValue, which is then used to create instances with full enumeration. Enum member names are simply upper case strings of corresponding values.
    • DerivedEnumValue classes are usually cached in codecs, and garbage-collected when all its references are cleared.
  4. edgedb.Object changes.

    • [Breaking Change] The custom implementation of __hash__() on edgedb.Object is dropped, now hash() simply returns a hash on the memory address.
    • [Breaking Change] The custom implementation of rich comparion is dropped, that means <, >, <=, >= will stop working on edgedb.Object instances, and == is now equivalent to is for edgedb.Object instances.
    • edgedb.Object instances will now yield True for dataclasses.is_dataclass() check.
    • edgedb.Object instances can now be used in dataclasses.as_dict() to recursively generate a dict containing all properties and links (excluding link properties).
  5. The performance impact is minimal. We are still using the most efficient C-API and C/Cython implementations to offer query results,

No more Python 3.6

As Python 3.6 is no longer supported itself 10 months ago, edgedb-python is also dropping support for Python 3.6.

edgedb-python 1.0 now supprots only Pyhton 3.7 to Python 3.11.

New Features

Code generation

#363

Now you can create one or more .edgeql files in your EdgeDB project directory, and run:

$ python -m edgedb.codegen

or alternatively:

$ edgedb-py

This command will search through the EdgeDB project directory and generate typesafe query code for the .edgeql files.

#379

edgedb.Link and edgedb.LinkSet types, as well as the way to access them, are deprecated in edgedb-python 1.0 and will be dropped in 2.0. For example, with a given schema:

type Person {
    multi link friends -> Person {
        property strength -> float32;
    }
}

Expression like person["friends"] will now emit a DeprecationWarning. This deprecates the old way to access link properties like person["friends"][0].strength. Instead, a new way is introduced: you should now use person.friends[0]["@strength"].

Detail Changelog

Changes

  • Implement dataclass for EdgeObject (#359) (by @fantix in dfb8c8b0 for #359)

  • Redo edgedb basic types to inherit from builtin types (#366) (by @fantix in b11b9917 for #366)

  • Officially drop 3.6 support (#373) (by @msullivan in 7b76bc73 for #373)

  • Support Python 3.11 (#375) (by @msullivan in 04b0da2a for #375)

  • Codegen with the describe_query() API (#363) (by @fantix in 361221df for #363)

  • Add codegen docs (#380) (by @colinhacks in 23dd42e6 for #380)

  • Use typing_extension.Literal in codegen for Python 3.7 (by @fantix in 6d0d6abc)

  • Add all to edgedb/init.py (by @fmoor in d3ef6d93)

Fixes

  • Improve duration parsing (by @fmoor in 241c80d8)

  • Tweak wording in query_single() error messages (#369) (by @msullivan in e24bb538 for #369)

  • Fix flake tests on python3.7 (#371) (by @msullivan in 583e1cbd for #371)

  • Don't reject tuple arguments on the client side (#370) (by @msullivan in 09c950fd for #370)

  • Correct edgedb.Client.close() timeout behavior (by @fantix in 33a912c1)

  • Ping first if conn is idle for too long (#365) (by @fantix in 99cf78a0 for #365)

  • Use @-prefixed keys in object codec for link properties (#384) (by @fantix in 68480f92 for #377)

Deprecations

  • Deprecate object links and simplify link property access (#379) (by @fantix in 2c5dcc70 for #379)

v0.24.0

1 year ago

Changes

  • Remove DSN from create_client() (by @elprans in 90811058 for #303)

  • Add support for protocol v1.0 (by @fantix in 51344fe9 for #306)

  • improve error when passing empty query arguments (by @nsidnev in 7a393ec5)

  • Accept args in execute() and use the new Execute message (by @fantix in 52987010 for #310)

  • drop legacy agruments encoding with named tuple codec (by @nsidnev in ef96e763)

  • Stop using Parse, replace use of headers with fields (by @elprans in b2c9e4bf)

  • Change headers format to str:json (by @fantix in f17a4fd3 for #319)

  • Document rolling back a transaction (by @fmoor in 266f18be)

  • Support EDGEDB_WAIT_UNTIL_AVAILABLE environment variable (by @fmoor in c27ab361)

  • Add with_globals() and friends through state over the protocol (by @fantix in 8582ec14 for #315)

  • Implement support for range types (by @elprans in a415b9f2 for #332)

  • Implement support for cal::date_duration (by @elprans in e77615b7 for #335)

  • Recover from failed COMMIT (by @fantix in 9f09e78e)

  • Allow <array<range<T>>> arguments (by @fmoor in 243250cf for #351)

v0.23.0

2 years ago

Changes

  • Retry on TransactionError when attempting to commit (by @msullivan in f1bf68d2 for #299)

v0.17.2

2 years ago

v0.13.0

3 years ago
  • New APIs: conn.retrying_transaction() and conn.raw_transaction().
  • conn.transaction() has been deprecated.
  • conn.aclose() implements graceful disconnect from the DB server.
  • Starting transactions in conn.execute() is no longer allowed.
  • wait_until_available parameter for connection APIs.

v0.7.0a5

4 years ago

Fixes

  • Fix SCRAM implementation to adhere to the spec (by @tailhook in 99351291 for #60)

  • Update SASL-related protocol messages (by @tailhook in cc95d8d0)

  • Set protocol version to 0.7 (by @1st1 in 919a4c7f)