Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support computed columns in SQLAlchemy ORM #474

Merged
merged 1 commit into from
Dec 2, 2022

Conversation

hammerhead
Copy link
Member

Summary of the changes / Why this is an improvement

Fixes crate/sqlalchemy-cratedb#112

Checklist

  • CLA is signed

Copy link

@BaurzhanSakhariev BaurzhanSakhariev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@amotl amotl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Niklas,

thank you very much for this excellent contribution. Can I humbly ask you to add a short section about the usage of this feature to the documentation at docs/sqlalchemy.rst?

I think another subsection within the Table definition section 1 would be the right place, just like the "``_id`` as primary key" section. While being at it, feel free to add corresponding anchors like .. _table-definition: to those subsections as well.

I think it will be enough to just demonstrate the example from the test case there, showing off the entity schema together with a few words of prose.

class DummyTable(self.Base):
    __tablename__ = 't'
    ts = sa.Column(sa.BigInteger, primary_key=True)
    p = sa.Column(sa.BigInteger, sa.Computed("date_trunc('day', ts)"))

Thank you in advance and with kind regards,
Andreas.

Footnotes

  1. https://github.com/crate/crate-python/blob/master/docs/sqlalchemy.rst#id10

@hammerhead hammerhead force-pushed the hammerhead/computed-columns branch 2 times, most recently from d22aa30 to bcf565f Compare December 2, 2022 09:39
Copy link
Member

@amotl amotl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@hammerhead hammerhead merged commit 5d60ddf into master Dec 2, 2022
@hammerhead hammerhead deleted the hammerhead/computed-columns branch December 2, 2022 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support generated columns
4 participants