Re: [sqlalchemy] ROLLBACK not happening with transaction in test suite

2018-05-28 Thread Mike Bayer
On Mon, May 28, 2018, 8:00 PM Mike Bayer wrote: > On Mon, May 28, 2018 at 7:23 PM, Scott Colby wrote: > > Hello all, > > > > I am working on testing a project that uses SQLalchemy with the pytest > > testing framework. I have adapted the code from the docs to pytest as > shown. > > > > logging.g

Re: [sqlalchemy] ROLLBACK not happening with transaction in test suite

2018-05-28 Thread Mike Bayer
On Mon, May 28, 2018 at 7:23 PM, Scott Colby wrote: > Hello all, > > I am working on testing a project that uses SQLalchemy with the pytest > testing framework. I have adapted the code from the docs to pytest as shown. > > logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO) > > cursor_ha

[sqlalchemy] ROLLBACK not happening with transaction in test suite

2018-05-28 Thread Scott Colby
Hello all, I am working on testing a project that uses SQLalchemy with the pytest testing framework. I have adapted the code from the docs to pytest as sho

Re: [sqlalchemy] Attribute error on '_returning' when compiling Executable ClauseElement

2018-05-28 Thread Mike Bayer
yup, as long as the recipe is doing what you need it's all good. not sure if that prevents the RETURNING phrase from emitting, though, that's part of what i want to look into. might change the query plan. On Mon, May 28, 2018 at 3:15 PM, Charles Langlois wrote: > Ok, thanks! For now, I guess

Re: [sqlalchemy] Attribute error on '_returning' when compiling Executable ClauseElement

2018-05-28 Thread Charles Langlois
Ok, thanks! For now, I guess setting self._returning is a reasonable workaround? Le lun. 28 mai 2018 à 15:13, Mike Bayer a écrit : > I've added > https://bitbucket.org/zzzeek/sqlalchemy/issues/4267/explain-example-is-not-working-w-crud > to look at this at some point. > > On Mon, May 28, 2018 at

Re: [sqlalchemy] Attribute error on '_returning' when compiling Executable ClauseElement

2018-05-28 Thread Charles Langlois
Yes, that is the case, sorry for the lack of context. Example: query = delete(MyMapper.__table__).where(MyMapper.my_column == value) result = session.execute(explain(query)) # exception occurs Le lun. 28 mai 2018 à 12:09, Mike Bayer a écrit : > I would assume you're putting an insert(), updat

Re: [sqlalchemy] Re: Is it possible to reflect oracle materialized view using metadata.reflect()?

2018-05-28 Thread Mike Bayer
On Mon, May 28, 2018 at 11:07 AM, Андрей В. wrote: > Thanks for answer. Having understood the problem, I'm found that MV > reflecting correct even if view=True was not passed to metadata.reflect() > method, because MV presented in ALL_TABLE view of DB as regular table. > My case is using metadata.

Re: [sqlalchemy] Attribute error on '_returning' when compiling Executable ClauseElement

2018-05-28 Thread Mike Bayer
I would assume you're putting an insert(), update() , or delete() into the explain() ? that codepath wouldn't be called otherwise, or if you can show me exactly how to reproduce we can update the recipe. thanks! On Mon, May 28, 2018 at 11:51 AM, Charles Langlois wrote: > Following the recipe to

Re: [sqlalchemy] problem using or_ with like()?

2018-05-28 Thread Mike Bayer
you might have gotten an answer to this on stackoverflow already, the general idea is that query.filter() calls add up together using AND, when you do an OR you need to enclose all the OR conditions within the parenthesis: q = Articles.query.filter(or_( Articles.article_name.like("%" + name +

[sqlalchemy] Attribute error on '_returning' when compiling Executable ClauseElement

2018-05-28 Thread Charles Langlois
Following the recipe to create an 'explain' clause element on the bitbucket repository , trying to execute a query using `explain` result in an attribute error: SubTest error: Traceback (most recent call last): File "/usr/lib/

Re: [sqlalchemy] Re: Is it possible to reflect oracle materialized view using metadata.reflect()?

2018-05-28 Thread Андрей В .
Thanks for answer. Having understood the problem, I'm found that MV reflecting correct even if view=True was not passed to metadata.reflect() method, because MV presented in ALL_TABLE view of DB as regular table. My case is using metadata.reflect() "only" argument which should be exactly a list

Re: [sqlalchemy] Re: Is it possible to reflect oracle materialized view using metadata.reflect()?

2018-05-28 Thread Mike Bayer
On Mon, May 28, 2018 at 6:36 AM, Андрей В. wrote: > Sorry, i was hurried to ask a question, now it is became clear for me, that > in my DB synonyms used not as just same-name-synonym, but as pointer(when > synonym name and object(table/view) it points to is not equal). > So real question - could I

[sqlalchemy] Re: Is it possible to reflect oracle materialized view using metadata.reflect()?

2018-05-28 Thread Андрей В .
Sorry, i was hurried to ask a question, now it is became clear for me, that in my DB synonyms used not as just same-name-synonym, but as pointer(when synonym name and object(table/view) it points to is not equal). So real question - could I reflect MV or regular table by synonym if it's names a

[sqlalchemy] Is it possible to reflect oracle materialized view using metadata.reflect()?

2018-05-28 Thread Андрей В .
Hi, I'm use SQLAlchemy 1.2.5 to work with existinq thirdparty Oracle DB. So I'm reflecting set of tables/views I need to work with: tbl_list = ['table_1', 'table_2', ...] eng = create_engine(connection_string) md = MetaData(bind=eng) md.reflect(only=tbl_list, views=True) but sqlalchemy.exc.In