I have inherited an SQLAlchemy model which interfaces to an MSSQL db. Most tables have a modified column. The columns are calculated within the db so the model declares them like this:
modified = Column(TIMESTAMP, FetchedValue())
When I call this property it comes back as a read-only buffer:
>>> Thing.modified
<read-only buffer for 0xa901fa0, size 8, offset 0 at 0xa901fc0>
# as a string...
>>> str(Thing.modified)
'\x00\x00\x00\x00\x00\x85o8'
What I need to do is convert it to a datetime. Is this possible? How? Any help would be awesome.
There’s not really an affirmative answer to this question. That data type in MSSQL is actually a sequence number, despite the name. So it’s not really possible to convert it to a datetime object.