I need to run pd.read_sql with no date parsing.
Under parse_dates parameter in the documentation for pd.read_sql, it states that it can be Dict of {column_name: arg dict}, where the arg dict corresponds to the keyword arguments of pandas.to_datetime() Especially useful with databases without native Datetime support, such as SQLite.
In the to_datetime documentation, by default, errors='raise'. This issue should be fixed if I can change it to errors='ignore' or errors='coerce'.
I tried implementing this like this, see below:
pd.read_sql(query, con, parse_dates={'col_name': {'errors': 'ignore'}}, chunksize=10**5)
This runs without errors but still parses dates.
The code is not very relevant for this issue. It's basically just:
df = pandas.read_sql(sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, columns=None, chunksize=10**5)
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_sql.html
Need to turn off date parsing to prevent this error:
File "expense.py", line 20, in <module>
for df in gen:
File "C:\Users\rfrigo\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\io\sql.py", line 1453, in _query_iterator
data = cursor.fetchmany(chunksize)
ValueError: year -6371 is out of range