[sqlalchemy] calling LENGTH() in SQLite?

2019-07-29 Thread James Hartley
Perhaps I have been up too many hours, but my syntax foo is fizzling. Given the following class, I want to compute the string length of "position" instead of storing it as another attribute which can get out of sync. eg. class Position(Base): __tablename__ = 'position' id =

[sqlalchemy] Re: How to catch exceptions (the best practice)

2019-07-29 Thread Jonathan Vanasco
On Saturday, July 27, 2019 at 4:53:06 PM UTC-4, Nestor Diaz wrote: > > it then raise an exception, however I can not > catch the exception, even if I set up a try-catch block, however if I > add a DBSession.flush() inside the try, the sql sentence is executed and > therefore I can catch the

Re: [sqlalchemy] loss of precision when retrieving DATETIME2 column from MSSQL

2019-07-29 Thread Mike Bayer
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

Re: [sqlalchemy] loss of precision when retrieving DATETIME2 column from MSSQL

2019-07-29 Thread peter bell
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

Re: [sqlalchemy] How to catch exceptions (the best practice)

2019-07-29 Thread Mike Bayer
On Sat, Jul 27, 2019, at 4:53 PM, Nestor Diaz wrote: > Hello everybody. > > I am experimenting with sqlalchemy and pyramid, following the tutorial > steps at: > > https://docs.pylonsproject.org/projects/pyramid/en/latest/quick_tutorial/databases.html > > The example above is a wiki, with a