File tree 3 files changed +10
-8
lines changed
3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ Unreleased
11
11
- SQLAlchemy DDL: Allow setting ``server_default`` on columns to enable
12
12
server-generated defaults. Thanks, @JanLikar.
13
13
14
- - Allow handling "aware" datetime values with time zone info when inserting or updating.
14
+ - Allow handling datetime values tagged with time zone info when inserting or updating.
15
15
16
16
17
17
2023/04/18 0.31.1
Original file line number Diff line number Diff line change @@ -142,8 +142,9 @@ Refresh locations:
142
142
Updating Data
143
143
=============
144
144
145
- Both when inserting or updating data, values for ``TIMESTAMP `` columns can be obtained
146
- in different formats. Both literal strings and datetime objects are supported.
145
+ Values for ``TIMESTAMP `` columns can be obtained as a string literal, ``date ``,
146
+ or ``datetime `` object. If it contains timezone information, it is converted to
147
+ UTC, and the timezone information is discarded.
147
148
148
149
>>> import datetime as dt
149
150
>>> timestamp_full = " 2023-06-26T09:24:00.123+02:00"
Original file line number Diff line number Diff line change @@ -99,13 +99,14 @@ __ https://crate.io/docs/crate/reference/en/latest/general/ddl/data-types.html#c
99
99
100
100
.. NOTE ::
101
101
102
- Values of ``TIMESTAMP `` columns will always be stored using a ``LONG `` type,
103
- representing the `Unix time `_ (epoch) timestamp, i.e. number of seconds which
104
- have passed since 00:00:00 UTC on Thursday, 1 January 1970.
102
+ When using ``date `` or ``datetime `` objects with ``timezone `` information,
103
+ the value is implicitly converted to a `Unix time `_ (epoch) timestamp, i.e.
104
+ the number of seconds which have passed since 00:00:00 UTC on
105
+ Thursday, 1 January 1970.
105
106
106
107
This means, when inserting or updating records using timezone-aware Python
107
- ``datetime `` objects, timezone information will not be preserved. If you
108
- need to store it, you will need to use a separate column.
108
+ ``date `` or `` datetime `` objects, timezone information will not be
109
+ preserved. If you need to store it, you will need to use a separate column.
109
110
110
111
111
112
.. _data-types-sqlalchemy :
You can’t perform that action at this time.
0 commit comments