Skip to content

Releases: graphql-python/graphene-sqlalchemy

v3.0.0rc1

04 Dec 21:43
9c2bc84
Compare
Choose a tag to compare

RELEASE CANDIDATE

This is the last release with feature additions before we move graphene-sqlalchemy 3.0 to GA 🎉
We have implemented some awesome new features, including new filters, and SQLAlchemy 2.0 support that we are very excited about.

Please test this release and report any issues you find so we can fix them for the release.

When upgrading and testing, please take care of the previous release notes and look at the following breaking changes PR:
#371

If you are using hybrid properties as fields in your GraphQL schema in combination with from __future___ import annotations, this issue might affect you. We are actively working towards a fix for str,bool and other primitives.
#396

A more detailed upgrade guide summarizing all beta releases will be published with the full release.

What's Changed

Filters are out in early access 🎉

Graphene SQLAlchemy 3.0 will provide a completely overhauled filtering syntax, removing the need for an external plugin. We support automatically filtering over relationships and complex filter types as well as easy customization. Please check out the docs here and give us feedback about your experience! 😊
https://graphql-python.github.io/graphene-sqlalchemy/filters.html

Add Filters by @sabard in #357

Other contributions since the last beta release

New Contributors

Full Changelog: v3.0.0b4...v3.0.0rc1
Full Changelog since 2.x: 2.3.0...v3.0.0rc1

Thanks to everyone that contributed to this release and supported our biweekly maintainer meetings. We are looking forward to your feedback and appreciate any PRs 😊

v3.0.0b4

27 Feb 20:32
3720a23
Compare
Choose a tag to compare

What's Changed

  • Enable sorting when batching is enabled by @PaulSchweizer in #355
  • Add Black to pre-commit by @erikwrede in #361
  • Fix: RelationshipLoader should utilize DataLoader from the get_data_loader_impl() function, and not directly from aiodataloader library by @flipbit03 in #362
  • Add support for UUIDs in @hybrid_property by @flipbit03 in #363
  • chore: limit CI runs to master pushes & PRs by @erikwrede in #366
  • Support GQL interfaces for polymorphic SQLA models by @polgfred in #365
  • feat(async): add support for async sessions by @jendrikjoe in #350
  • Fix installation instruction: '--pre' instead of '>=3' by @zahrevsky in #372
  • refactor!: use the same conversion system for hybrids and columns by @erikwrede in #371
  • Stricter non-null fields for relationships by @polgfred in #367
  • fix singledispatch inheritance by @erikwrede in #377
  • chore: limit lint runs to master pushes and PRs by @sabard in #382
  • fix: warnings in docs build by @sabard in #383

New Contributors

Full Changelog: 3.0.0b3...v3.0.0b4

v3 Beta 3

08 Sep 09:34
bb7af4b
Compare
Choose a tag to compare
v3 Beta 3 Pre-release
Pre-release

This is a small fix. Graphene DataLoader is used when using graphene>=3.1.1 to allow for more frequent updates to DataLoaders & fix issues with pytest.
Please check the graphene release notes to learn more: https://github.com/graphql-python/graphene/releases/tag/v3.1.1

What's Changed

Full Changelog: 3.0.0b2...3.0.0b3

3.0.0b2

15 Jul 09:35
dfee3e9
Compare
Choose a tag to compare
3.0.0b2 Pre-release
Pre-release

What's Changed

Extended Support for hybrid_property

In older versions, hybrid properties of an SQLAlchemy model were converted to Strings in the SQLAlchemyObjectType, unless overridden by an ORMField. This release includes support for automatic type detection based on the type hints of the method.

Old Behavior

class Interval(Base):

    id = Column(Integer, primary_key=True)
    start = Column(Integer, nullable=False)
    end = Column(Integer, nullable=False)

    @hybrid_property
    def length(self):
        return self.end - self.start

class GQLInterval(SQLAlchemyObjectType):
    class Meta:
        model = Interval

GraphQL Schema:

type Interval {
  id: ID!
  start: Int!
  end: Int!
  length: String
}

New Behavior

class Interval(Base):
    #Fields from above

    @hybrid_property
    def length(self) -> int:
        return self.end - self.start

class GQLInterval(SQLAlchemyObjectType):
    class Meta:
        model = Interval

GraphQL Schema:

type Interval {
  id: ID!
  start: Int!
  end: Int!
  length: Int
}

The feature supports all basic python types (#340) , ObjectTypes and Unions of ObjectTypes (Union[T1,T2] or 3.10-style: T1 | T2).
Adding additional converters is possible similar to column type converters using @convert_sqlalchemy_hybrid_property_type.register(matcher). See converter.py for examples.

This feature is experimental and subject to extension (NonNull Support, Hybrid Methods, @property support). If you encounter an issue, see room for improvement or want to help extend the feature, please open an issue!

  • Support setting @hybrid_property's return type from the functions type annotations. by @flipbit03 in #340
  • Supplant @hybrid_property's type annotation support with Optional[T] by @flipbit03 in #343

Docstring Support for hybrid_property

The default behavior was changed to include the docstrings of hybrid property methods into the schema, similar to the docstrings of the column. This can be overridden using an ORMField providing an empty docstring.

  • Pick up the docstrings of hybrid properties by @bim9262 in #344

Changes to existing Column Type converters

This PR brought updates and additions to type converters. Some type converters were adjusted to map to the correct graphene scalar type. The changes might reflect in your schema types.

Type Old Scalar New Scalar
sqa.Date graphene.String graphene.Date
sqa.Time graphene.String graphene.Time
sqa.DateTime graphene.String graphene.DateTime
postgresql.UUID graphene.String graphene.UUID
sqa_utils.UUID --- graphene.UUID
sqa.Variant --- Converts Variant.impl
sqa_utils.IPAddressType --- graphene.String
sqa_utils.EmailType --- graphene.String
sqa_utils.URLType --- graphene.String

Additionally, Enums are now generated from Column.key instead of Column.name. See #301

Other changes

New Contributors

Full Changelog: 3.0.0b1...3.0.0b2

3.0.0b1

21 Sep 04:05
d6dd67e
Compare
Choose a tag to compare
3.0.0b1 Pre-release
Pre-release

Upgrade to v3 🎉

  • Now supports sqlalchemy v1.4
  • Replaces the promises.dataloader with aiodataloader making batched queries asyncio-dependant

2.3.0

04 Jun 21:59
20ecaea
Compare
Choose a tag to compare

Batching

Batching can be now enabled via the batching param:

  • we can configure all the fields of a type at once via SQLAlchemyObjectType.meta.batching
  • or we can specify it for a specific field via ORMfield.batching. This trumps SQLAlchemyObjectType.meta.batching.

See relevant PR: #253 #254 #260

Add support for Non-Null SQLAlchemyConnectionField

See #261

Simplify access to model Connection

One can access the connection on the SQLAlchemyObjectType directly. ex: MyModel.connection

And other minor fixes

Regression Fix

14 Aug 13:30
a361c52
Compare
Choose a tag to compare

Fixes issue #234. The regression was introduced in 9a0f740.

Custom resolve_<field_name> functions were no longer call for fields auto-generated by SQLAlchemyObjectType. The issue was caused by a soon-to-be-documented feature that allows users to rename auto-generated fields (aka ORMField.model_attr).

2.2.1

18 Jun 14:48
c89cf80
Compare
Choose a tag to compare
  • Fix createConnectionField deprecation warnings (#229)

2.2.0

28 May 19:36
3332f45
Compare
Choose a tag to compare

Changelog

  • Improve creation of column and sort enums (db3e9f4)

2.1.2

17 Apr 21:14
e362e3f
Compare
Choose a tag to compare

Changelog

  • Deprecate createConnectionField. The connection factory is now specified via the connection_field_factory attribute of the Meta class of SQLAlchemyObjectType. The connection factories now have access to the relation and the registry. ef1fce2