On Mon, Jul 29, 2019, at 1:49 PM, peter bell wrote:
> A belated thank you for your response.
>
> This worked fine for individual tables but I got an unexpected result (at
> least, unexpected to me) when using this approach with the union or union_all
> functions.
>
> The TypeDecorator was
A belated thank you for your response.
This worked fine for individual tables but I got an unexpected result (at
least, unexpected to me) when using this approach with the union or
union_all functions.
The TypeDecorator was only applied to the first table in the union /
union_all. I'm sure I
On Thu, Jul 18, 2019, at 1:27 PM, peter bell wrote:
>> It seems that you would like to retrieve this value as a string so that you
>> can have precision that's not supported by Python datetime
>
> Yes. If a table contains DATETIME2 columns, I would like to return all those
> columns as a
It seems that you would like to retrieve this value as a string so that you
can have precision that's not supported by Python datetime
Yes. If a table contains DATETIME2 columns, I would like to return all
those columns as a string.
I was able to achieve that by applying your StringDate
On Thu, Jul 18, 2019, at 7:56 AM, peter bell wrote:
> You are correct - it seems the issue is in pyodbc
but the pyodbc issue was fixed over a year ago. It seems that you would like to
retrieve this value as a string so that you can have precision that's not
supported by Python datetime, so
You are correct - it seems the issue is in pyodbc
I installed pymssql and used that when creating the sqlalchemy engine
object.
The DATETIME2 column is now mapped to a string (which has all 7 digits
preserved)
Thanks for your help,
br
Peter
So this :
from sqlalchemy import *
URL =
Right, but I don't know if the conversion from number to datetime is
being done by SQLAlchemy or pyodbc. If it's pyodbc, then you'll need
to find the fix there, rather than in SQLAlchemy.
Simon
On Thu, Jul 18, 2019 at 11:43 AM peter bell wrote:
>
>
> I think the issue is more fundamental than
I think the issue is more fundamental than that.
Based on the output in my test program, the mssql DATETIME2 column is being
mapped to the Python datetime data type.
Based on the documentation (https://docs.python.org/3/library/datetime.html),
that data type can only hold fractional seconds
I've never used SQL Server or ODBC, but I wonder if this is a pyodbc issue:
https://github.com/mkleehammer/pyodbc/issues/235
Do you have the same problem if you use pyodbc directly, rather than SQLAlchemy?
Simon
On Thu, Jul 18, 2019 at 10:44 AM peter bell wrote:
>
>
> I am new to sqlalchemy
I am new to sqlalchemy and I am trying to retrieve results from a table
containing a DATETIME2 column in a SQL Server database. A SQL Server
DATETIME2 column includes a seven-digit number from 0 to 999 that
represents the fractional seconds.
When I retrieve the results of the table into
10 matches
Mail list logo