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

Inserting a datetime.date into a TIMESTAMP column does not work [PYFB44] #63

Closed
firebird-automations opened this issue Nov 11, 2014 · 3 comments

Comments

@firebird-automations
Copy link

Submitted by: Dominik Psenner (dpsenner)

Looks like the conversion does not handle the datetime.date datatype properly.

Traceback (most recent call last):in __read
File "fdb\\fbcore.pyo", line 3338, in execute
File "fdb\\fbcore.pyo", line 3006, in _execute
File "fdb\\fbcore.pyo", line 2812, in __Tuple2XSQLDA
File "fdb\\fbcore.pyo", line 2270, in _convert_timestamp
AttributeError: 'datetime.date' object has no attribute 'date'

Commits: a3d6310 FirebirdSQL/fbt-repository@7ed6220

@firebird-automations
Copy link
Author

Commented by: Dominik Psenner (dpsenner)

There is an obvious workaround of combining the datetime.date object into a datetime.datetime datatype when one knows he is going to write a datetime.date object into a TIMESTAMP just like this:

from datetime import date
from datetime import datetime
dateToInsert = datetime.date.today()
fixedDateToInsert = datetime.combine(dateToInsert, datetime.min.time())

But it would look much more pythonic if this was implicitly handled by the conversion function.

@firebird-automations
Copy link
Author

Modified by: @pcisar

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 1.4.2 [ 10641 ]

@firebird-automations
Copy link
Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants