I'm uploading all the records in a data frame to a SQL Server table but to_sql seems to be rounding datetime values. ie:
assignee created_date updated_date
my_name 2019-09-16 14:17:23 2019-11-26 14:48:39.261
Both dates are set as datetime64[ns]. Then, I call the following method:
df.to_sql(MY_TABLE_NAME, engine, if_exists='append', index=False, dtype=dtypes)
dtypes has the content bellow:
{'assignee': NVARCHAR(length=255), 'created_date': <class 'sqlalchemy.sql.sqltypes.DateTime'>, 'updated_date': <class 'sqlalchemy.sql.sqltypes.DateTime'>}
When I look at the updated data in SQL Server, I get the following updated_date:
2019-11-26 14:48:39.260
And the correct updated_date is (261 instead of 260):
2019-11-26 14:48:39.261
Any ideas why is this happening?
Thanks everyone!