Skip to content

Commit

Permalink
Merge branch 'main' into feat/sdk-0.31.0
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon authored Jul 3, 2024
2 parents 1b68511 + 7924641 commit 4b66558
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions tap_snowflake/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,35 @@
from pathlib import Path
from typing import Any, Iterable, List, Tuple
from uuid import uuid4
import datetime

import sqlalchemy
from singer_sdk import SQLConnector, SQLStream, metrics
from singer_sdk.helpers._batch import BaseBatchFileEncoding, BatchConfig
from singer_sdk.streams.core import REPLICATION_FULL_TABLE, REPLICATION_INCREMENTAL
import singer_sdk.helpers._typing
from snowflake.sqlalchemy import URL
from sqlalchemy.sql import text

unpatched_conform = singer_sdk.helpers._typing._conform_primitive_property


def patched_conform(
elem: Any,
property_schema: dict,
) -> Any:
"""Overrides Singer SDK type conformance to prevent dates turning into datetimes.
Converts a primitive (i.e. not object or array) to a json compatible type.
Returns:
The appropriate json compatible type.
"""
if isinstance(elem, datetime.date):
return elem.isoformat()
return unpatched_conform(elem=elem, property_schema=property_schema)


singer_sdk.helpers._typing._conform_primitive_property = patched_conform


class ProfileStats(Enum):
"""Profile Statistics Enum."""
Expand Down
2 changes: 1 addition & 1 deletion tests/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@
"type": ["number"]
},
"o_orderdate": {
"format": "date-time",
"format": "date",
"type": ["string"]
},
"o_orderpriority": {
Expand Down

0 comments on commit 4b66558

Please sign in to comment.