Skip to content

Commit

Permalink
add ref for extract
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-beedie committed May 28, 2024
1 parent 29e1888 commit ae8163e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
16 changes: 15 additions & 1 deletion py-polars/docs/source/reference/sql/functions/temporal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ Temporal
- Converts a formatted string date to an actual Date type.
* - :ref:`DATE_PART <date_part>`
- Extracts a part of a date (or datetime) such as 'year', 'month', etc.
* - :ref:`EXTRACT <extract>`
- Offers the same functionality as `DATE_PART` with slightly different syntax.

.. _date:

DATE
----
Converts a formatted string date to an actual Date type; ISO-8601 format is assumed unless a strftime-compatible formatting string is provided as the second parameter.
Converts a formatted string date to an actual Date type; ISO-8601 format is assumed
unless a strftime-compatible formatting string is provided as the second parameter.

**Example:**

Expand All @@ -38,3 +41,14 @@ Extracts a part of a date (or datetime) such as 'year', 'month', etc.
SELECT DATE_PART('year', column_1) FROM df;
SELECT DATE_PART('day', column_1) FROM df;
.. _extract:

EXTRACT
-------
Extracts a part of a date (or datetime) such as 'year', 'month', etc.

.. code-block:: sql
SELECT EXTRACT(isoyear FROM column_1) FROM df;
SELECT EXTRACT(minute FROM column_1) FROM df;
10 changes: 7 additions & 3 deletions py-polars/docs/source/reference/sql/set_operations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ Set Operations

UNION
-----
Combine the result sets of two or more SELECT statements into a single result set.
Combine the distinct result sets of two or more SELECT statements.
The final result set will have no duplicate rows.

**Example:**

Expand All @@ -37,7 +38,8 @@ Combine the result sets of two or more SELECT statements into a single result se

UNION ALL
---------
Combine the result sets of two or more SELECT statements into a single result set.
Combine the complete result sets of two or more SELECT statements.
The final result set will be composed of all rows from each query.

**Example:**

Expand All @@ -51,7 +53,9 @@ Combine the result sets of two or more SELECT statements into a single result se

UNION BY NAME
-------------
Combine the result sets of two or more SELECT statements into a single result set.
Combine the result sets of two or more SELECT statements by column name
instead of by position; if `ALL` is omitted the final result will have
no duplicate rows.

**Example:**

Expand Down

0 comments on commit ae8163e

Please sign in to comment.