[sqlalchemy] naming convention

2015-12-12 Thread Ofir Herzas
I want to start using the naming convention but have several questions regarding this feature: 1. Does the naming convention support Sequences? If not, what's the proper way of handling them? 2. Are Booleans going to be supported in the near future or will I have to name them separa

Re: [sqlalchemy] Re: load_only doesn't affect joins

2015-12-03 Thread Ofir Herzas
Thanks for caring ;) On Dec 3, 2015 6:08 PM, "Jonathan Vanasco" wrote: > Thanks for posting a full self-contained working example of your problem! > > -- > You received this message because you are subscribed to a topic in the > Google Groups "sqlalchemy" group. > To unsubscribe from this topic,

Re: [sqlalchemy] load_only doesn't affect joins

2015-12-03 Thread Ofir Herzas
On Thursday, December 3, 2015 at 5:23:55 PM UTC+2, Michael Bayer wrote: > > > > On 12/03/2015 10:08 AM, Mike Bayer wrote: > > > > > > On 12/03/2015 06:16 AM, Ofir Herzas wrote: > >> load_only as stated > >> in http://docs.sqlalchemy.org/en/late

[sqlalchemy] load_only doesn't affect joins

2015-12-03 Thread Ofir Herzas
load_only as stated in http://docs.sqlalchemy.org/en/latest/orm/loading_columns.html does the following: "An arbitrary set of columns can be selected as “load only” columns, which will be loaded *while deferring all other columns* on a given entity..." However, joined relationships are not affe

[sqlalchemy] can't read CLOB columns

2015-11-08 Thread Ofir Herzas
Sqlalchemy 1.0.6 Trying to issue a simple select on a CLOB column, throws the following exception: Traceback (most recent call last): File "/opt/5.3/server/handlers/orm.py", line 81, in select result = query.all() File "/opt/ve/python-2.7.6/lib/python2.7/site-packages/sqlalchemy/orm/qu

Re: [sqlalchemy] Exception in logger while using query options

2015-10-14 Thread Ofir Herzas
xception though it should be easy to reproduce). I know this property is not a column, hence is why I imagine it could be right... On Oct 14, 2015 4:31 PM, "Mike Bayer" wrote: > > > On 10/14/15 5:34 AM, Ofir Herzas wrote: > > An exception pertaining to the logger is rais

[sqlalchemy] Re: Exception in logger while using query options

2015-10-14 Thread Ofir Herzas
BTW: sqlalchemy 1.0.8, python 3.3.4 On Wednesday, October 14, 2015 at 12:34:04 PM UTC+3, Ofir Herzas wrote: > > An exception pertaining to the logger is raised when using query.options > > Here is the relevant part of the exception: > > > query = query.options(sql

[sqlalchemy] Exception in logger while using query options

2015-10-14 Thread Ofir Herzas
An exception pertaining to the logger is raised when using query.options Here is the relevant part of the exception: query = query.options(sqlalchemy.orm.load_only(*properties)) File "/opt/enigmai/ve/python-3.3.4/lib/python3.3/site-packages/sqlalchemy/orm/query.py", line 1100, in optio

RE: [sqlalchemy] MetaData.sorted_tables is inconsistant

2015-06-14 Thread Ofir Herzas
bject: Re: [sqlalchemy] MetaData.sorted_tables is inconsistant On 6/14/15 9:06 AM, Ofir Herzas wrote: It seems that MetaData.sorted_tables returns a different result each time. While the results seem to be always correct, it is an odd behavior. A topological sort is non-deterministic. I

[sqlalchemy] MetaData.sorted_tables is inconsistant

2015-06-14 Thread Ofir Herzas
It seems that MetaData.sorted_tables returns a different result each time. While the results seem to be always correct, it is an odd behavior. I would expect sorted_tables to return the same results every time import sqlalchemy as sa engine = sa.create_engine("", echo=False) meta = sa.MetaData(b

Re: [sqlalchemy] select rows ordered by dependency

2015-06-10 Thread Ofir Herzas
ut-part-2%3A-adjacency-list-using-ctes/ > > > > On 6/9/15 2:13 PM, Ofir Herzas wrote: > > I have a self referencing table like the following: > > class Employee(Base): > __tablename__ = "t_employee" > > > id = sa.Column(BigInteger,

[sqlalchemy] select rows ordered by dependency

2015-06-09 Thread Ofir Herzas
I have a self referencing table like the following: class Employee(Base): __tablename__ = "t_employee" id = sa.Column(BigInteger, sa.Sequence('%s_id_seq' % __tablename__), primary_key=True, nullable=False) manager_id = sa.Column(BigInteger, sa.ForeignKey("t_employee.id", ondelete='

RE: [sqlalchemy] Does anyone know how to handle "NoSuchColumnError"

2015-05-04 Thread Ofir Herzas
s.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of Mike Bayer Sent: Monday, May 04, 2015 6:16 PM To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] Does anyone know how to handle "NoSuchColumnError" On 5/4/15 3:23 AM, Ofir Herzas wrote: For some reason, I get the following

RE: [sqlalchemy] Does anyone know how to handle "NoSuchColumnError"

2015-05-04 Thread Ofir Herzas
ke Bayer Sent: Monday, May 04, 2015 1:47 AM To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] Does anyone know how to handle "NoSuchColumnError" On 5/3/15 12:00 PM, Ofir Herzas wrote: Is there any danger using the implicit_returning=False on the engine? Or is it the

RE: [sqlalchemy] Does anyone know how to handle "NoSuchColumnError"

2015-05-03 Thread Ofir Herzas
know how to handle "NoSuchColumnError" On 5/3/15 2:01 AM, Ofir Herzas wrote: Hi Michael, Thank you very much for your fast response. I will give it a try. I tried to remove unneeded stuff but I think that the problem is in the track_changes mixin as I never got this error befor

Re: [sqlalchemy] Does anyone know how to handle "NoSuchColumnError"

2015-05-02 Thread Ofir Herzas
ril 30, 2015 at 7:03:10 PM UTC+3, Michael Bayer wrote: > > > > On 4/30/15 11:00 AM, Ofir Herzas wrote: > > Hi, > I'm using sqlalchemy 0.9.7 and cx_oracle 5.1.3 and every once in a while > (inconsistent), I get the following error: > > Traceback (most rece

[sqlalchemy] Does anyone know how to handle "NoSuchColumnError"

2015-04-30 Thread Ofir Herzas
Hi, I'm using sqlalchemy 0.9.7 and cx_oracle 5.1.3 and every once in a while (inconsistent), I get the following error: Traceback (most recent call last): File "/opt/enigmai/ve/python-2.7.6/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 1919, in flush self._flush(objects)

RE: [sqlalchemy] how to add an order column to an existing table

2014-10-13 Thread Ofir Herzas
in an employee id group On Oct 13, 2014, at 1:44 PM, Ofir Herzas wrote: I have found a solution although it seems a bit messy and doesn't work on Oracle (throws ORA-00933: SQL command not properly ended): my_table = sa.sql.table('my_table', sa.Colum

[sqlalchemy] Re: how to add an order column to an existing table

2014-10-13 Thread Ofir Herzas
my_table.c.employee_id, my_table.c.id)) query = my_table.update().values({my_table.c.level: temp.c.rank}).where( my_table.c.id == temp.c.id) engine.execute(query) Can someone help me out here? I need to fix this query to work on both mysql and Oracle and if there is a better way to achiev

[sqlalchemy] how to add an order column to an existing table

2014-10-12 Thread Ofir Herzas
I have the following table: my_table = sa.sql.table('my_table', sa.Column('id', sa.BigInteger), sa.Column('employee_id', sa.BigInteger)) and I want to add a 'rank' column using alembic. The addition itself is pretty straight forward using add_column but I also need to populate that co

Re: [sqlalchemy] selecting from a relationship

2014-09-04 Thread Ofir Herzas
co" wrote: > > > On Thursday, September 4, 2014 2:19:34 PM UTC-4, Ofir Herzas wrote: >> >> Nevertheless, is there a way to achieve what I want? (which is to >> selectively load several columns and this 'jobs' property from Employee) >> > >

RE: [sqlalchemy] selecting from a relationship

2014-09-04 Thread Ofir Herzas
mns on the EmployeeJob object. There are lots of examples at: http://docs.sqlalchemy.org/en/latest/orm/loading.html Hope that helps, Simon On 4 Sep 2014, at 19:17, Ofir Herzas wrote: > Nevertheless, is there a way to achieve what I want? (which is to > selectively load several col

RE: [sqlalchemy] selecting from a relationship

2014-09-04 Thread Ofir Herzas
04, 2014 8:42 PM To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] selecting from a relationship On Sep 4, 2014, at 1:32 PM, Ofir Herzas wrote: Thanks Michael, I'm using 0.9.7 and while your example did work, the following did not: Ok that's not a relationship()

RE: [sqlalchemy] selecting from a relationship

2014-09-04 Thread Ofir Herzas
chemy@googlegroups.com] On Behalf Of Michael Bayer Sent: Thursday, September 04, 2014 8:00 PM To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] selecting from a relationship On Sep 4, 2014, at 12:28 PM, Ofir Herzas wrote: Thanks Simon, I've tried the following:

Re: [sqlalchemy] selecting from a relationship

2014-09-04 Thread Ofir Herzas
d not be the default behavior (meaning that I don't want the defer the columns at model level) On Thursday, September 4, 2014 5:59:21 PM UTC+3, Simon King wrote: > > On Thu, Sep 4, 2014 at 3:28 PM, Ofir Herzas > wrote: > > Hi, > > I have a model similar to the following

[sqlalchemy] selecting from a relationship

2014-09-04 Thread Ofir Herzas
Hi, I have a model similar to the following: class Employee(Base): __tablename__ = "t_employee" id = sa.Column(Identifier, sa.Sequence('%s_id_seq' % __tablename__), primary_key=True, nullable=False) first_name = sa.Column(sa.String(30)) last_name = sa.Column(sa.String(30))

RE: [sqlalchemy] change Oracle sequence on insert

2014-07-21 Thread Ofir Herzas
: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of Michael Bayer Sent: Saturday, July 19, 2014 6:12 PM To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] change Oracle sequence on insert On Jul 19, 2014, at 3:38 AM, Ofir Herzas wrote: I have a table

[sqlalchemy] change Oracle sequence on insert

2014-07-19 Thread Ofir Herzas
I have a table with the following column: id = sa.Column(sa.Integer, sa.Sequence('id_seq'), primary_key=True, nullable=False) Usually, I have no problems inserting data, but every time I insert rows with specific id, it causes problems with Oracle since the sequence is not modified according

RE: [sqlalchemy] Oracle with sequence for primary key and that sequence out of sync

2014-06-25 Thread Ofir Herzas
Bayer Sent: Wednesday, June 25, 2014 4:27 PM To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] Oracle with sequence for primary key and that sequence out of sync On 6/25/14, 5:50 AM, Ofir Herzas wrote: Sorry to barge in, but I'm having the exact same issue and I'm pretty sure

Re: [sqlalchemy] Oracle with sequence for primary key and that sequence out of sync

2014-06-25 Thread Ofir Herzas
Sorry to barge in, but I'm having the exact same issue and I'm pretty sure no one altered the sequence manually. I'm using sqlalchemy 0.8, python 2.7.6, rhel 6.5, oracle 10g, cx_oracle with the same connection string as above This issue started just recently after running ok for more than a thou

Re: [sqlalchemy] Is there a reason why there is no dialect specific fix for ORA-01795?

2014-06-17 Thread Ofir Herzas
e in_ operator only for Oracle) Thanks, Ofir On Tuesday, June 17, 2014 4:18:11 PM UTC+3, Michael Bayer wrote: > > > On 6/17/14, 4:32 AM, Ofir Herzas wrote: > > ORA-01795: maximum number of expressions in a list is 1000 > > > > As I understand, there are several opt

[sqlalchemy] Is there a reason why there is no dialect specific fix for ORA-01795?

2014-06-17 Thread Ofir Herzas
ORA-01795: maximum number of expressions in a list is 1000 As I understand, there are several options to fix this issue (e.g. https://groups.google.com/forum/#!searchin/sqlalchemy/maximum$20number$20of$20expressions/sqlalchemy/Oa6YWNE0-IQ/6GVmy27B-FAJ or split in_ to several or_) Why not incor

RE: [sqlalchemy] Query for date between a range

2013-10-04 Thread Ofir Herzas
cls.month + '-' + cls.day, sa.Date) On Fri, Oct 4, 2013 at 2:25 PM, Ofir Herzas wrote: > I'm sorry, you should use hybrid_property: > > from sqlalchemy.ext.hybrid import hybrid_property > > class Plan(Base): > @hybrid_property > def calculated_date(self): &

RE: [sqlalchemy] Query for date between a range

2013-10-04 Thread Ofir Herzas
googlegroups.com Subject: Re: [sqlalchemy] Query for date between a range On Fri, 4 Oct 2013 15:55:07 +0300 "Ofir Herzas" wrote: > You can create a custom field in your model and check against it: > > class Plan(Base): > . > . > . > @property >

RE: [sqlalchemy] Query for date between a range

2013-10-04 Thread Ofir Herzas
You can create a custom field in your model and check against it: class Plan(Base): . . . @property def calculated_date(self): return date(self.year, self.month, self.day) Then, in your query, use that field: session.query(Plan).filter(Plan.calculated_date.between(fro

Re: [sqlalchemy] Re: Sqlalchemy sintax for a query with "not like" operator

2013-09-27 Thread Ofir Herzas
Hi Luca, Keep in mind that contains will not map to 'like'. Hence if you want your query to have a 'like' clause, you'll have to use the 'like' method (the end result of 'contains' will be the same though as 'like' beginning and ending with a percent sign). On Sep 27, 2013 5:06 PM, "pyArchInit Arc

Re: [sqlalchemy] Sqlalchemy sintax for a query with "not like" operator

2013-09-26 Thread Ofir Herzas
Each column has a 'like' method, so you should be able to filter by it: filter(~Table.field.like("%value1%")) Hi to all, I need to realize a query like this select * from my_table where field not like "%value1%" and field not like "%value2%" with a sqlalchemy sintax. I looked for around the doc

Re: [sqlalchemy] query question

2013-09-04 Thread Ofir Herzas
Haven't tried it myself, but I think you can use the add_columns method of Query. Check out http://docs.sqlalchemy.org/ru/latest/orm/query.html On 4 Sep, 2013 2:05 PM, "lars van gemerden" wrote: > I think i must be reading over something, but: > > is there a way to delay the selection of attri

RE: [sqlalchemy] Occasional IntegrityError when identifying model not by its ID

2013-09-03 Thread Ofir Herzas
unlike most other python web servers that use threads for request handling. How do you make sure that a single request uses a single SQLAlchemy session, and that the session gets closed properly at the end of the request? On Tue, Sep 3, 2013 at 1:08 PM, Ofir Herzas wrote: > I Agree, but when ther

Re: [sqlalchemy] Calculate birthdays

2013-08-28 Thread Ofir Herzas
What's wrong with Member.dateofbirth==datetime.today() ? On 28 Aug, 2013 7:47 PM, wrote: > Hi, > > I want to retrieve all the people who are born at today's date. I'm using > Flask with sqlalchemy; > > class Member(db.Model): >> > ... > > dateofbirth = Column(Date) > ... > > > In my view.py; > >