Skip to content

Commit

Permalink
Document Pseudo Columns
Browse files Browse the repository at this point in the history
Signed-off-by: Airton Zanon <me@airton.dev>
  • Loading branch information
airtonzanon committed Oct 22, 2019
1 parent 662baef commit 6b6fab4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/3_advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,23 @@ The `ROLLUP` modifier allows for aggregating to higher levels that the given gro
SELECT "id","category",SUM("price") FROM "products" GROUP BY ROLLUP("id","category")
Pseudo Column
------------------

A pseudo-column is an SQL assigned value (pseudo-field) used in the same context as an column, but not stored on disk.
The pseudo-column can change from database to database, so here it's possible to define them.

.. code-block:: python
from pypika import Query, PseudoColumn
CurrentDate = PseudoColumn('current_date')
Query.from_('products').select(CurrentDate)
.. code-block:: sql
SELECT current_date FROM "products"
Analytic Queries
----------------
Expand Down

0 comments on commit 6b6fab4

Please sign in to comment.