[sqlalchemy] Re: Recursive Queries in SQLAlchemy (WITH clause/SEARCH BY depth/breadth)

2018-04-19 Thread Jeremy Flowers
I take it you meant here: https://bitbucket.org/zzzeek/sqlalchemy/issues/3220/several-small-issues-with-oracle-recursive I'll look into this more tomorrow. Thanks for your time. On Thursday, 19 April 2018 23:14:23 UTC+1, Jonathan Vanasco wrote: > > almost everything in `func` is just standard sql

[sqlalchemy] Re: Recursive Queries in SQLAlchemy (WITH clause/SEARCH BY depth/breadth)

2018-04-19 Thread Jonathan Vanasco
almost everything in `func` is just standard sql that is executed in the database. `unnest` is a sql function that is used to turn arrays into tabular data. a search for CTE should surface 'suffix_with' which can be used to augment a query

[sqlalchemy] Re: Recursive Queries in SQLAlchemy (WITH clause/SEARCH BY depth/breadth)

2018-04-19 Thread Jeremy Flowers
Also in the materialised path example , what is What is unnest doing? Is it something like converting 1 row into many? -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper

[sqlalchemy] Re: Recursive Queries in SQLAlchemy (WITH clause/SEARCH BY depth/breadth)

2018-04-19 Thread Jeremy Flowers
Thanks for the feedback. CTE handles the WITH side of things. But how about depth/breadth first? On Thursday, 19 April 2018 22:28:00 UTC+1, Jonathan Vanasco wrote: > > In the example you pointed to, `c` are the columns of an object created by > `alias()` > > `secondary` was created as an

[sqlalchemy] Re: Recursive Queries in SQLAlchemy (WITH clause/SEARCH BY depth/breadth)

2018-04-19 Thread Jonathan Vanasco
In the example you pointed to, `c` are the columns of an object created by `alias()` `secondary` was created as an `alias()`, and the query has 2 columns that were queried and named via `label()` "id" and "ancestor_id" sqlalchemy has a lot of relevant docs if you search via the keyword "CTE".

[sqlalchemy] Re: Recursive Queries in SQLAlchemy (WITH clause/SEARCH BY depth/breadth)

2018-04-19 Thread Jeremy Flowers
I'm thinking 'c' must be some sort of column shorthand -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full

[sqlalchemy] Re: Recursive Queries in SQLAlchemy (WITH clause/SEARCH BY depth/breadth)

2018-04-19 Thread Jeremy Flowers
I suspect this may be trying to do something similar perhaps.. http://docs.sqlalchemy.org/en/latest/_modules/examples/materialized_paths/materialized_paths.html But I don't understand this part. Specifically where 'c' comes from: ancestors = relationship("Node", viewonly=True,

[sqlalchemy] Recursive Queries in SQLAlchemy (WITH clause/SEARCH BY depth/breadth)

2018-04-19 Thread Jeremy Flowers
I'm working on a system that has an underlying Oracle database... I was looking at this article here: https://oracle-base.com/articles/11g/recursive-subquery-factoring-11gr2 Can you do the equivalent of the Oracle WITH inside SQLAlchemy (I think this is also referred to as CTE in MS SQL Server

Re: [sqlalchemy] Redefine operator compilation for specific dialect

2018-04-19 Thread Антонио Антуан
Perfect, thanks чт, 19 апр. 2018 г., 20:17 Mike Bayer : > On Thu, Apr 19, 2018 at 9:52 AM, Антонио Антуан > wrote: > > So, anyway, I must implement BitAnd class? Or I can check if 'element.op > == > > &' inside compile function? > > > uh sure you

Re: [sqlalchemy] Redefine operator compilation for specific dialect

2018-04-19 Thread Mike Bayer
On Thu, Apr 19, 2018 at 9:52 AM, Антонио Антуан wrote: > So, anyway, I must implement BitAnd class? Or I can check if 'element.op == > &' inside compile function? uh sure you can do that, it would be sqlalchemy.sql.operators.and_op or something like that > > чт, 19 апр.

Re: [sqlalchemy] Re: unable to do nested select while using query object

2018-04-19 Thread su-sa
Hi Simon, you are absolutely correct, I just thought may be its something so obvious that some experienced people immediately see. I am sorry about not being in a position to put enough data. But luckily, I found out that the problem was only this that I was writing a parameter in the wrong

Re: [sqlalchemy] Redefine operator compilation for specific dialect

2018-04-19 Thread Антонио Антуан
So, anyway, I must implement BitAnd class? Or I can check if 'element.op == &' inside compile function? чт, 19 апр. 2018 г., 16:31 Mike Bayer : > On Thu, Apr 19, 2018 at 5:21 AM, Антонио Антуан > wrote: > > Hi guys. > > > > Is there any mechanism

Re: [sqlalchemy] Redefine operator compilation for specific dialect

2018-04-19 Thread Mike Bayer
On Thu, Apr 19, 2018 at 5:21 AM, Антонио Антуан wrote: > Hi guys. > > Is there any mechanism in SQLAlchemy which allows to redefine operator > compilation? I want to the same thing as already exists for functions. > An example for functions: > > > class

Re: [sqlalchemy] Use of in_() for relationships

2018-04-19 Thread Mike Bayer
On Thu, Apr 12, 2018 at 10:14 AM, Mike Bayer wrote: > there may have been a very old issue for this but if there was, it's > long forgotten. found it: https://bitbucket.org/zzzeek/sqlalchemy/issues/1140/implement-in_-for-relations feel free to propose how you

[sqlalchemy] Redefine operator compilation for specific dialect

2018-04-19 Thread Антонио Антуан
Hi guys. Is there any mechanism in SQLAlchemy which allows to redefine operator compilation? I want to the same thing as already exists for functions. An example for functions: class IntDiv(GenericFunction): type = Integer package = 'adc_custom' name = 'div' identifier = 'div'

Re: [sqlalchemy] Re: unable to do nested select while using query object

2018-04-19 Thread Simon King
Trying to diagnose a problem with a query when we don't have any way to run it for ourselves or sample data to run it against, is very difficult. If you want more help, I think you're going to need to produce a self-contained script with your table definitions and some sample data, that runs