mongoengine-arrow
Description
Arrow datetime support for MongoEngine
Install
pip3 install --upgrade mongoengine-arrow
How it works
Feed it datetime with or without timezone info in any format Arrow supports.
To confirm whether it will work, feed it to arrow.get() function.
Usage example
# Import the field
from mongoengine_arrow import ArrowDateTimeField
...
# Define model
class MyModel(Document):
timestamp = ArrowDateTimeField(required=True)
...
# Get instance
myinstance = MyModel.objects.first()
# Get timestamp in local time
timestamp = myinstance.timestamp.to("local")
# Set timestamp in any timezone
myinstance.timestamp = arrow.get(2021, 1, 1, tzinfo="UTC")
# Set timestamp from datetime
from datetime import datetime
myinstance.timestamp = datetime(2021, 1, 1)
# Set timestamp from datetime that has tzinfo
from datetime import datetime
from dateutil.tz import gettz
myinstance.timestamp = datetime(2021, 1, 1, tzinfo=gettz("UTC+5"))
Metadata
Release files for mongoengine-arrow 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mongoengine-arrow-0.1.3.tar.gz | 2.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mongoengine_arrow-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.8 kB
Release files / mongoengine-arrow-0.1.3.tar.gz
| Download URL | mongoengine-arrow-0.1.3.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
afa1a9730f1333e9e759c721a5012e5a8abe7187704fbed635776586daaf885e
|
|
BLAKE2b-256 checksum How to use checksums |
e6322db1c7c7f005acc900663f477cc634ccbcf4663015a2b2dc37d6da2da02d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.8.2 Linux/5.10.11-zen2-1-zen
|
Release files / mongoengine_arrow-0.1.3-py3-none-any.whl
| Download URL | mongoengine_arrow-0.1.3-py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7ea65892ba2d8010f56d9c10557a1342b8a0f8028a2c3f7d1e8c10090ea803f8
|
|
BLAKE2b-256 checksum How to use checksums |
c97fab4cb152957a52ce08e1849c5b6efa29cc26cb52e01ad6430ba4ebd5472b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.8.2 Linux/5.10.11-zen2-1-zen
|