Skip to content

Commit

Permalink
fix(sqlite): register coversion to isoformat for pandas.Timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Jun 8, 2022
1 parent ee500b6 commit fe95dca
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ibis/backends/sqlite/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@

from __future__ import annotations

import sqlite3
from pathlib import Path
from typing import TYPE_CHECKING

import pandas as pd
import sqlalchemy as sa

if TYPE_CHECKING:
Expand Down Expand Up @@ -70,6 +72,8 @@ def do_connect(self, path: str | Path | None = None) -> None:
f"sqlite:///{path if path is not None else ':memory:'}"
)

sqlite3.register_adapter(pd.Timestamp, lambda value: value.isoformat())

@sa.event.listens_for(engine, "connect")
def connect(dbapi_connection, connection_record):
"""Register UDFs on connection."""
Expand Down

0 comments on commit fe95dca

Please sign in to comment.