Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimum date range not supported #94

Open
aroder opened this issue Jul 14, 2020 · 1 comment · May be fixed by #95
Open

Minimum date range not supported #94

aroder opened this issue Jul 14, 2020 · 1 comment · May be fixed by #95

Comments

@aroder
Copy link

aroder commented Jul 14, 2020

Source database has a date field with default values of "0001-01-01"

The tap fails when it hits one of these, with "Year 0 is out of range"

Happens on incremental.py, line 97

@aroder
Copy link
Author

aroder commented Jul 14, 2020

After some investigation, Python's minimum date is the epoch (1970). Postgres supports something like 4700 BC.

When the value is read from the database, psycopg2 attempts to map the postgres data type to the corresponding python data type. The value is below the minimum value supported by Python, so the conversion fails.

The psycopg2 best practice in this case is to write a custom type caster to identify the situation and resolve it. In this case, the resolution could be to just convert to a python string.

See https://www.psycopg.org/docs/advanced.html#type-casting-from-sql-to-python

@aroder aroder linked a pull request Jul 14, 2020 that will close this issue
2 tasks
This was referenced Nov 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant