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

Add documentation for calculated columns #162

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,17 @@ This can be e.g. done by using ``alembic``:
op.get_bind().execute("RENAME COLUMN TAB.valid_tmp to valid")
# optionally, remove also the server default by using alter column

Computed columns
~~~~~~~~~~~~~~~~
SAP HANA supports two computed/calculated columns:

* <col> AS <expr>: the column is fully virtual and the expression is evaluated with each SELECT
* <col> GENERATED ALWAYS AS <expr>: the expression is evaluated during insertion and the value
is stored in the table

By default, sqlalchemy-hana creates a ``GENERATED ALWAYS AS`` if a ``Computed`` column is used.
If ``Computed(persisted=False)`` is used, a fully virtual column using ``AS`` is created.

Alembic
-------
The sqlalchemy-hana dialect also contains a dialect for ``alembic``.
Expand Down