mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-19 15:04:10 +02:00
Add type conversion for Panda's Timestamp
Add type conversion for Panda's Timestamp, if Panda library is present in system (thanks for this project, I was about to do the same thing from scratch)
This commit is contained in:
parent
22250a9c73
commit
fdf7cb4a98
1 changed files with 13 additions and 0 deletions
|
|
@ -8,6 +8,12 @@ import pathlib
|
||||||
|
|
||||||
SQLITE_MAX_VARS = 999
|
SQLITE_MAX_VARS = 999
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
import pandas as pd
|
||||||
|
except ImportError:
|
||||||
|
pd = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import numpy as np
|
import numpy as np
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
@ -64,6 +70,13 @@ if np:
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# If pandas is available, add more types
|
||||||
|
if pd:
|
||||||
|
COLUMN_TYPE_MAPPING.update(
|
||||||
|
{
|
||||||
|
pd.Timestamp: "TEXT"
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
class AlterError(Exception):
|
class AlterError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue