[sqlalchemy] Re: __init__ method

2018-04-26 Thread Jose Miguel Ibáñez
recommended ? El jueves, 26 de abril de 2018, 18:48:53 (UTC+2), Jose Miguel Ibáñez escribió: > > Hi all ! > > when defining a class (derived from Base), when is recommended to define > the __init__() method ? I know this consideration https://goo.gl/2umBJv, > but I can't

[sqlalchemy] __init__ method

2018-04-26 Thread Jose Miguel Ibáñez
Hi all ! when defining a class (derived from Base), when is recommended to define the __init__() method ? I know this consideration https://goo.gl/2umBJv, but I can't see the diference when creating objects for database population. It seems __init_() is never required. Thanks ! José M. --

Re: [sqlalchemy] python customer function

2015-05-11 Thread Jose Soares
thanks for point me to this docs, Jonathan, I'm going to take a look at it. j On 08/05/2015 23:30, Jonathan Vanasco wrote: Would you be able to use a TypeDecorator? http://docs.sqlalchemy.org/en/latest/core/custom_types.html#sqlalchemy.types.TypeDecorator That will allow you to define a func

Re: [sqlalchemy] python customer function

2015-05-08 Thread Jose Soares
Hi Mike, thanks to reply my question. In my case the extract function is unuseful because it needs a datetime to extract parts of it but I don't have a datetime but a codified date. I need to manage a string which is a personal code with info about name, birthday, birth place and gender. Infact

Re: [sqlalchemy] is True vs ==True

2015-03-31 Thread Jose Soares
*also: session.query(Rischio.c.codice).select_from(Rischio).filter(Rischio.c.peso_gruppo == '1') #**true** **session.query(Rischio.c.codice).select_from(Rischio).filter(Rischio.c.peso_gruppo == '0') #false** * j On 30/03/2015 17:24, Jose Soares wrote: Yeah, thi

Re: [sqlalchemy] is True vs ==True

2015-03-30 Thread Jose Soares
u can still use __eq__ and pep-8 will not complain, because there's no way to implement "is True" or "is None". then you'll have this: *session.query(Rischio.c.codice).select_from(Rischio).filter(Rischio.c.peso_gruppo == sa.**sql.true()**)* :) On 03/30/2015 10:52 A

Re: [sqlalchemy] is True vs ==True

2015-03-30 Thread Jose Soares
Hmm! in this case we must distinguish between the python syntax and the sqlalchemy syntax.:-( j On 30/03/2015 12:37, Simon King wrote: On Mon, Mar 30, 2015 at 10:59 AM, Jose Soares wrote: Hi all, While I changed some obsolete syntax as defined in (https://www.python.org/dev/peps/pep-0008

[sqlalchemy] is True vs ==True

2015-03-30 Thread Jose Soares
Hi all, While I changed some obsolete syntax as defined in (https://www.python.org/dev/peps/pep-0008/) like (is True instead of ==True) also False and None. I realized that sqlalchemy do not support them What can I do to avoid this behavior? -

Re: [sqlalchemy] session query and column names

2015-01-12 Thread Jose Soares
Why don't you pass the params to session.query as a dictionary into filter_by as in: In [1]: by_where_clause=dict(specie_codice='42', specie_descrizione='Nutrie') In [2]: print session.query(Specie).filter_by( **by_where_clause ).count() 2015-01-12 12:37:40,518 INFO sqlalchemy.engine.base.En

Re: [sqlalchemy] DefaultClause

2015-01-12 Thread Jose Soares
I see, thus, this definition: Column('abc', Unicode(20), server_default='abc') Column('adef', Numeric(12,3), server_default=text('1.5')), is equivalent to this one: Column('abc', Unicode(20), DefaultClause('abc')) Column('def', Numeric(12,3), DefaultClause(text('1.

[sqlalchemy] UNION howto

2014-10-01 Thread Jose Soares
Hi all, Could someone help me to define in sqlalchemy the following query: sql="""SELECT count(*) FROM (SELECT cod_sticker AS bruciato FROM scadenziario UNION SELECT cod_sticker AS bruciato FROM sopralluogo UNION SELECT sticker_checklist AS bruciato FROM sopralluogo

Re: [sqlalchemy] VARCHAR(None CHAR)

2013-11-22 Thread Jose Soares
Ok. It works, thanks, Michael j On 11/22/2013 04:22 PM, Michael Bayer wrote: On Nov 22, 2013, at 4:50 AM, Jose Soares wrote: Hi all, I have a query generated by sqlalchemy like this: SELECT fattura_master.tipo_documento AS fattura_master_tipo_documento, fattura_master.sezionale

[sqlalchemy] VARCHAR(None CHAR)

2013-11-22 Thread Jose Soares
AS fattura_master_tipo_documento, fattura_master.sezionale || %(sezionale_1)s || CAST(fattura_master.anno AS VARCHAR) || %(param_1)s || CAST(fattura_master.numero AS VARCHAR) AS pk FROM fattura_master In [3]: qry.count() /home/jose/buildout/eggs/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/engine/default.py:5

Re: [sqlalchemy] distinct on

2013-05-24 Thread Jose Soares
Thanks for reply, Mariano. j On 05/23/2013 12:37 PM, Mariano Mara wrote: On 05/23/2013 04:42 AM, jo wrote: |Hi all, I wondered if it is possible to execute a partial distinct in sqlalchemy. The following query works in oracle and postgresql: select distinct col1, first_value(col2) over (p

[sqlalchemy] joinedload + limit

2013-03-21 Thread Jose Neto
Given the following statement: p = db.query(Profile).options(joinedload('*')).filter_by(id=p.id).limit(1).one() I will get a subquery + a join, instead of a "pure" join: SELECT [...] FROM (SELECT profile.id AS profile_id, ...FROM profile WHERE profile.id = %(id_1)s LIMIT %(param_1)s) AS anon

Re: [sqlalchemy] query.filter AND ( ... OR ... OR ) how to?

2013-01-23 Thread Jose Soares
It works, thanks Simon. j On 01/23/2013 12:53 PM, Simon King wrote: On Wed, Jan 23, 2013 at 11:30 AM, Jose Soares wrote: Hi all, I'm trying to compile a query to avoid Oracle limit of 1000 in IN(): def chunks(l, n): """ Yield successive n-sized chunks from l. "

[sqlalchemy] query.filter AND ( ... OR ... OR ) how to?

2013-01-23 Thread Jose Soares
Hi all, I'm trying to compile a query to avoid Oracle limit of 1000 in IN(): def chunks(l, n): """ Yield successive n-sized chunks from l. """ for i in xrange(0, len(l), n): yield l[i:i+n] qry=session.query(Azienda).fiter(Azienda.c.cap=='') val=[1,3,3,4,3,23,2,4,5,6,7,8,9,90,

Re: [sqlalchemy] NotSupportedError

2012-04-19 Thread jose soares
Yes, now it works, thanks a lot Michael. :-) j Michael Bayer wrote: func.cast() is not correct. Use the cast() function which handles this special syntax: from sqlalchemy import cast, Integer from sqlalchemy.sql import column from sqlalchemy.dialects import oracle print cast(column('x'), Int

[sqlalchemy] StaleDataError: UPDATE statement on table '?' expected to update 1 row(s); 0 were matched

2012-04-17 Thread jose soares
Hi all, Does anybody know what this error means? "/home/users/admin/b/eggs/SQLAlchemy-0.6.7-py2.6.egg/sqlalchemy/orm/unitofwork.py", line 446, in execute uow File "/home/users/admin/b/eggs/SQLAlchemy-0.6.7-py2.6.egg/sqlalchemy/orm/mapper.py", line 1864, in _save_obj (table.description,

Re: [sqlalchemy] sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12505: TNS:listener does not currently know of SID given in connect descriptor

2011-12-19 Thread jose soares
Michael Bayer wrote: On Dec 19, 2011, at 10:43 AM, jose soares wrote: this is my tnsnames.ora: # tnsnames.ora Network Configuration File: /usr/share/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora # Generated by Oracle configuration tools. LISTENER_SICER = (ADDRESS

Re: [sqlalchemy] sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12505: TNS:listener does not currently know of SID given in connect descriptor

2011-12-19 Thread jose soares
Michael Bayer wrote: On Dec 19, 2011, at 10:17 AM, jose soares wrote: Michael Bayer wrote: On Dec 19, 2011, at 3:28 AM, jose soares wrote: I tried as you said Michael and this is the error message: sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12154: TNS:could not

Re: [sqlalchemy] sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12505: TNS:listener does not currently know of SID given in connect descriptor

2011-12-19 Thread jose soares
Michael Bayer wrote: On Dec 19, 2011, at 3:28 AM, jose soares wrote: I tried as you said Michael and this is the error message: sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12154: TNS:could not resolve the connect identifier specified I tried like so: sqlalchemy.dburi="o

Re: [sqlalchemy] sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12505: TNS:listener does not currently know of SID given in connect descriptor

2011-12-19 Thread jose soares
Michael Bayer wrote: On Dec 17, 2011, at 1:52 AM, jo wrote: create_engine("oracle://user:password@SHELL") could you tell me how it becomes in sqlalchemy.dburi on tg prod.cfg ? sqlalchemy.dburi="oracle://username:password@host:port/service_name" I tried in this way: sqlalchemy.db

Re: [sqlalchemy] sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12505: TNS:listener does not currently know of SID given in connect descriptor

2011-12-14 Thread jose soares
RVER = DEDICATED) (SERVICE_NAME = SHELL) ) ) maybe there's a discrepancy between the hostnames in use in the file vs. your URL. On Dec 14, 2011, at 4:50 AM, jose soares wrote: I also tried two different connection mode. The first one works but the second one using makedsn doesn

Re: [sqlalchemy] sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12505: TNS:listener does not currently know of SID given in connect descriptor

2011-12-14 Thread jose soares
t_db_conn(parms): #this doesn't work import cx_Oracle dsn = cx_Oracle.makedsn(parms['host'],parms['port'],parms['sid']) return cx_Oracle.connect(parms['user'], parms['password'], dsn) jose soares wrote: Hi Michael, I tried y

Re: [sqlalchemy] sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12505: TNS:listener does not currently know of SID given in connect descriptor

2011-12-14 Thread jose soares
connect return dialect.connect(*cargs, **cparams) File "/home/admin/buildout/eggs/SQLAlchemy-0.6.6-py2.6.egg/sqlalchemy/engine/default.py", line 249, in connect return self.dbapi.connect(*cargs, **cparams) sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12505: TNS:listener does not currently kno

[sqlalchemy] sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12505: TNS:listener does not currently know of SID given in connect descriptor

2011-12-13 Thread jose soares
Hi all, I'm trying to connect to an oracle db using sqlalchemy with turbogears1 and I get this error: sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-12505: TNS:listener does not currently know of SID given in connect descriptor I tried making the connection using cs_Oracle and it works:

Re: [sqlalchemy] MultipleResultsFound

2011-03-30 Thread jose soares
Mike Conley wrote: You issued a query with a .one() qualifier and there is more than one row in the database satisfying the condition. Example: 2 names in a table firstname="pete", lastname="smith" firstname="john", lastname="smith" query for rows lastname="smith" with .one() will fail because

[sqlalchemy] MultipleResultsFound

2011-03-30 Thread jose soares
Hi all, I got, for the first time the following error: "../lib/python2.6/site-packages/SQLAlchemy-0.6.0-py2.6.egg/sqlalchemy/orm/query.py", line 1417, in one "Multiple rows were found for one()") MultipleResultsFound: Multiple rows were found for one() Does anyone know what that means? j

[sqlalchemy] joinedload & alias

2010-05-21 Thread jose soares
Hi all, I'm trying to use joinedload('specie') in a query but it makes an unexpected alias of table name to 'specie_1' and it conflict with passed orderby column "specie.descrizione", as in: ProgrammingError: ('(ProgrammingError) invalid reference to FROM-clause entry for table "specie"\nLI

[sqlalchemy] CheckConstraint compatibility

2010-05-19 Thread jose soares
Hi all, I have to create a constraint like this: CheckConstraint('data_start <= CURRENT_DATE'), it works for PostgreSQL but it doesn't work for Oracle10. Is there some workaround to make it compatible with pg and oracle? j -- You received this message because you are subscribed to the

[sqlalchemy] ConcurrentModificationError: Updated rowcount 0 does not match number of objects updated 1

2010-05-19 Thread jose soares
Hi all, Someone knows what this error mean? ... File "/home/ve/sfera/release/sicer/BASE/model/anagraficaAlta/unita_aziendale.py", line 154, in aggiorna_capi_bovini x.flush() File "/home/ve/lib/python2.5/site-packages/SQLAlchemy-0.3.10-py2.5.egg/sqlalchemy/ext/assignmapper.py", line 20,

Re: [sqlalchemy] about commit()

2010-04-23 Thread jose soares
Yes Lance, now it works, thank you v.m. :-) j Lance Edgar wrote: On 4/23/2010 9:19 AM, jose soares wrote: jo wrote: Hi all, I need to insert a new row and get back the last inserted id, I have some difficulty using the flush(), then I'm trying with commit() but I can't understand

Re: [sqlalchemy] about commit()

2010-04-23 Thread jose soares
Lance Edgar wrote: On 4/23/2010 9:19 AM, jose soares wrote: jo wrote: Hi all, I need to insert a new row and get back the last inserted id, I have some difficulty using the flush(), then I'm trying with commit() but I can't understand how commit() works in 0.6. In the following sc

Re: [sqlalchemy] about commit()

2010-04-23 Thread jose soares
jo wrote: Hi all, I need to insert a new row and get back the last inserted id, I have some difficulty using the flush(), then I'm trying with commit() but I can't understand how commit() works in 0.6. In the following script I try to update a row and it works properly but when I try to insert

Re: [sqlalchemy] about commit()

2010-04-23 Thread jose soares
Mariano Mara wrote: Excerpts from jo's message of Fri Apr 23 03:16:21 -0300 2010: Hi all, I need to insert a new row and get back the last inserted id, I have some difficulty using the flush(), then I'm trying with commit() but I can't understand how commit() works in 0.6. In the following s

Re: [sqlalchemy] cls._state / cls._state.get('original')

2010-04-16 Thread jose soares
history.deleted) engine = sa.create_engine('sqlite://') Base.metadata.create_all(bind=engine) Session = saorm.sessionmaker(bind=engine) sess = Session() u = User(name='jose') sess.add(u) display_history('Before commit', u, 'name') sess.commit

Re: [sqlalchemy] column_prefix

2010-04-16 Thread jose soares
I am sorry Michael, Maybe the problem is not in the column_prefix, The thing that I don't understand in this query is why sa tries to change the primary key of this row. I changed in my form only the value of id_operator, thus I expected a query like: UPDATE anagrafica SET id_operatore=1695 W

Re: [sqlalchemy] cls._state / cls._state.get('original')

2010-04-16 Thread jose soares
King Simon-NFHD78 wrote: -Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of jose soares Sent: 16 April 2010 11:03 To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] cls._state / cls._state.get('ori

Re: [sqlalchemy] cls._state / cls._state.get('original')

2010-04-16 Thread jose soares
jo wrote: Hi all, I cannot find anymore the attribute _state : if (not cls._state or not cls._state.get('original') or (cls._state['original'].data.get(k) != data.get(k: Could someone please help me? thank you j To explain better my problem, in version 0.3 my models have the attribute

Re: [sqlalchemy] Re: TypeError: synonym() got an unexpected keyword argument

2010-04-14 Thread jose soares
Yes I see, now, thank you, Williams. j GHZ wrote: Hi, http://www.sqlalchemy.org/changelog/CHANGES_0_6beta3 * 'proxy' argument on synonym() is removed. This flag did nothing throughout 0.5, as the "proxy generation" behavior is now automatic. On

[sqlalchemy] TypeError: synonym() got an unexpected keyword argument

2010-04-14 Thread jose soares
Hi all, seems synonym in version 0.6 don't have proxy parameter. 'user_name' : synonym('logname', proxy=True), TypeError: synonym() got an unexpected keyword argument 'proxy' j -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this g

Re: [sqlalchemy] SQLAlchemy.func.max()

2010-04-08 Thread jose soares
Michael Bayer wrote: jo wrote: I was using heavily the column_prefix and my code is full of it, as in: mapper(Anagrafica, tbl['anagrafica'], column_prefix = 'anagrafica_', extension=History(), properties = { 'comune' : relation( Comune, p

Re: [sqlalchemy] TypeError: unsupported operand type(s) for +: 'Decimal' and 'float'

2010-04-06 Thread jose soares
Michael Bayer wrote: jose soares wrote: Hi all, I'm using Oracle and PostgreSQL with SQLAlchemy and I have some troubles to make the code compatible with both of them. Numeric sa type returns a different type with oracle and pg. For example, in the following table I'm using

[sqlalchemy] TypeError: unsupported operand type(s) for +: 'Decimal' and 'float'

2010-04-06 Thread jose soares
Hi all, I'm using Oracle and PostgreSQL with SQLAlchemy and I have some troubles to make the code compatible with both of them. Numeric sa type returns a different type with oracle and pg. For example, in the following table I'm using the Column 'importo' with type Numeric as: tbl['presta

[sqlalchemy] UniqueConstraint case sensitive

2010-03-26 Thread jose soares
Hi all, I would like to create an UniqueConstraint like this one: CREATE UNIQUE INDEX uniqinx ON prod(lower(name)) Could you help me to translate it to SQLAlchemy using UniqueConstraint ? Thank you. j -- You received this message because you are subscribed to the Google Groups "sqlalch

[sqlalchemy] incoherent behavior between oracle and postgres on engine.rowcount

2009-01-24 Thread Jose Soares
Hi all, I wonder why there's such difference between oracle and pg: oracle: (Pdb) engine.connect().execute(sql).fetchone() select * from ruolo_permesso where cod_ruolo = 'SYSADMIN' and cod_permesso='TIPO_FIGURA' and inserimento='1' None (1273, 'SYSADMIN', 'TIPO_FIGURA', 1, 1, 1, 1) (Pdb) en

[sqlalchemy] Re: TypeError: can't compare offset-naive and offset-aware datetimes

2009-01-01 Thread jose
I solved this problem by putting parameter timezone=True in every DateTime Column. Thanks anyway. :-) jo a...@svilendobrev.com wrote: >lookup the group, there was someone getting similar error about >timezones last month or so > >On Tuesday 30 December 2008 18:09:18 jo wrote: > > >>Hi all, >

[sqlalchemy] TypeError: can't compare offset-naive and offset-aware datetimes

2008-12-10 Thread jose
Hi, What this message means? self.save_objects(trans, task) File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/unitofwork.py", line 1023, in save_objects task.mapper.save_obj(task.polymorphic_tosave_objects, trans) File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/mapper.py",

[sqlalchemy] Re: case_sensitive

2008-12-09 Thread jose
I tried it, as you suggested me, Michael... Index('valuta_desc_uniq', func.lower(valuta.c.descrizione), unique=True) File "/usr/lib/python2.4/site-packages/sqlalchemy/schema.py", line 1045, in __init__ self._init_items(*columns) File "/usr/lib/python2.4/site-packages/sqlalchemy/schem

[sqlalchemy] Re: circular reference

2008-12-06 Thread jose
I gave it a name but now... raise FlushError("Circular dependency detected " + repr(edges) + repr(queue)) sqlalchemy.exceptions.FlushError: Circular dependency detected [] jose wrote: >the use_alter=True raises this error: > >ForeignKeyConstraint(['id_op

[sqlalchemy] Re: create index with a condition

2008-12-06 Thread jose
ndexes >http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/schema.html?highlight=ddl#sqlalchemy.schema.DDL > > > >On Dec 6, 2008, at 1:15 PM, jose wrote: > > > >>Hi all, >> >>I would like to create an index with a condition, like this: >> >>CREAT

[sqlalchemy] Re: circular reference

2008-12-06 Thread jose
oreignKeyConstraint requires a name") Michael Bayer wrote: >specify use_alter=True to one or both ForeignKey constructs. > > >On Dec 6, 2008, at 12:37 PM, jose wrote: > > > >>Hi all, >> >>I have two tables in my schema with circular references and I d

[sqlalchemy] Re: Column('last_updated', onupdate=func.current_timestamp())

2008-12-06 Thread jose
Yes, Michael, I see how it works now. Thank you j Michael Bayer wrote: >that is the correct syntax. It will take effect any time an update() >construct is used or when the ORM updates a row. Because onupdate is >not a DDL-side construct, it will not take effect if you use a plain >text U

[sqlalchemy] create index with a condition

2008-12-06 Thread jose
Hi all, I would like to create an index with a condition, like this: CREATE UNIQUE INDEX univocita_codice_aziendale on azienda (lower(codice_aziendale), stato_record) WHERE stato_record = 'A' Is there a way to do that, using the Index() command? j --~--~-~--~~

[sqlalchemy] circular reference

2008-12-06 Thread jose
Hi all, I have two tables in my schema with circular references and I don't know hot to create them. tbl['anagrafica']=Table('anagrafica',database.metadata, Column('id', Integer, Sequence('anagrafica_id_seq'), primary_key=True, nullable=False), Column('nome', Unicode(200), nul

[sqlalchemy] Re: declarative

2008-08-19 Thread Jose Galvez
Well to be honest I am still looking at both to see which is a better fit for me, so I've not really made up my mind yet Jose Michael Bayer wrote: > On Aug 19, 2008, at 2:43 PM, Jose Galvez wrote: > > >> What is the proposed stability of declarative functions which I gue

[sqlalchemy] Re: declarative

2008-08-19 Thread Jose Galvez
I take it back about Elixir and legacy databases, it seems to work with them just as easy as sqlalchemy does. I'll have to look much closer at Elixir Jose Jose Galvez wrote: > What is the proposed stability of declarative functions which I guess > are pretty new. From what I

[sqlalchemy] declarative

2008-08-19 Thread Jose Galvez
lixir looks like a mich simplier and more feature complete then declarative, but It does not look like Elixir works with a legacy databse (but I'm still looking into that) so I was wondering about declarative's long term stability

[sqlalchemy] Re: Elixir 0.6.1 released!

2008-08-19 Thread Jose Galvez
A defines relationships to be difficult at times Jose Jorge Vargas wrote: > On Mon, Aug 18, 2008 at 11:37 PM, Jose Galvez <[EMAIL PROTECTED]> wrote: > >> I'm not trying to be an ass, but what are the advantages to using Elixer >> > > well you did sound like o

[sqlalchemy] Re: Elixir 0.6.1 released!

2008-08-18 Thread Jose Galvez
fname, self.lname) print 'first get everyone in the database' people = People.query() for p in people: print p Jose Gaetan de Menten wrote: > I am very pleased to announce that version 0.6.1 of Elixir > (http://elixir.ematia.de) is now available. As always, feedback is > ver

[sqlalchemy] Re: SQLAlchemy 0.4beta6 released !!

2007-09-27 Thread jose
Thanks for the info and thanks for some great software Jose On Sep 27, 8:03 am, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Sep 27, 2007, at 12:17 AM, Jose Galvez wrote: > > > > > Dear Micheal, > > Does this mean that with web apps since the session is now "

[sqlalchemy] Re: SQLAlchemy 0.4beta6 released !!

2007-09-26 Thread Jose Galvez
Dear Micheal, Does this mean that with web apps since the session is now "weak referencing" that we will no longer have to call Session.remove() to clear out Sessions? Specifically I'm referencing what Mike Orr wrote in the pylonscookbook. Jose Michael Bayer wrote: > This s

[sqlalchemy] Re: Import problem

2007-09-20 Thread Jose Galvez
ference to the egg in your easy_install.pth file Jose Goutham Lakshminarayan wrote: > > Its an import error. The module doesnt exist. There is only a folder > called SQLAlchemy-0.3.10-py2.5.egg(This is a folder,not an EGG file) > in my site packages. Nothing else related to sqlalc

[sqlalchemy] Re: Import problem

2007-09-20 Thread Jose Galvez
what error do you get is you enter import sqlalchemy Jose Goutham Lakshminarayan wrote: > This might trivial to most of u but Iam having problems importing > sqlalchemy on windows. The installation went without a problem but > when i went to site packages directory there was a >

[sqlalchemy] Re: SAContext 0.3.0

2007-07-11 Thread Jose Galvez
I've just reread the sacontext doc string and realize that what I've said really does not make any sense. To go back a step I would advocate using "default" rather then None Jose On 7/11/07, Jose Galvez <[EMAIL PROTECTED]> wrote: > > Well I would prefer not using

[sqlalchemy] Re: SAContext 0.3.0

2007-07-11 Thread Jose Galvez
e ini file (sqlalchemy..uri). So what I would advocate is eliminating the special "default" and just make users specify the correct key, I think that would be much less ambiguous then None Jose On 7/11/07, Mike Orr <[EMAIL PROTECTED]> wrote: > > > On 7/11/07, Jose Galvez <[

[sqlalchemy] Re: SAContext 0.3.0

2007-07-11 Thread Jose Galvez
understand that you are moving away from the the implicit to the explicit which is great, I just thought passing None to mean default is awkward when you could just as easily added None as the default in the method def. (the same could be said about add_engine) Just my two-cents-worth Jose On 7/

[sqlalchemy] Re: query date field

2007-07-07 Thread Jose Galvez
Thanks, everyone for the pointers. Since func is not database agnostic, I think I'll make my own functions in my database module that simply use func so if I ever do switch form mysql to something else at least I'll know where to find all the stuff that needs changing Jose jose wro

[sqlalchemy] query date field

2007-07-06 Thread jose
e an error stating that the col does not have a year property. So how should I do this? Jose --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy

[sqlalchemy] Re: whats going to break in 0.4

2007-07-04 Thread Jose Galvez
Got it thanks jose Michael Bayer wrote: > > On Jul 4, 7:30 pm, Jose Galvez <[EMAIL PROTECTED]> wrote: > >> Thanks Michael, >> I went back and reread the "Proposal" thread and I finally get what >> scalar() does and how it is different form one().

[sqlalchemy] Re: whats going to break in 0.4

2007-07-04 Thread Jose Galvez
ery object Jose Michael Bayer wrote: > On Jul 4, 2007, at 6:19 PM, Jose Galvez wrote: > > >> Dear Micheal, >> >> so far I really like all the new stuff, especially using the query >> generator. I've got a question, what is going to be the preferred >&

[sqlalchemy] Re: whats going to break in 0.4

2007-07-04 Thread Jose Galvez
umbersome. From one the previous posts it looks like one() might be what I'm looking for, but that obviously not in the current release. Do you have an ETA for the 0.4 build? Thanks for the info and a great product Jose Michael Bayer wrote: > hi gang - > > seems like I am getting

[sqlalchemy] Re: detached instance or is already persistent in a different Sess

2007-04-19 Thread jose
I solved it using self.record.save_or_update() j Arun Kumar PG wrote: > Looks like you are trying to use objects across different sessions. > > try to do an explicit session.expunge(obj) to the first object > returned before use the object in other session. > > On 4/19/

[sqlalchemy] detached instance or is already persistent in a different Sess

2007-04-19 Thread jose
hi group, I have the following error that I don't know how to solve... * -- *self.record = Comune.get(pk) *... *self.record.get_from_dict(data=data,update=True) if self.record._state['modified']: self.record.save() *sqlalchemy.exceptions.Inv

[sqlalchemy] Re: lower / upper case

2007-04-18 Thread Jose Soares
Disrupt07 ha scritto: > I have a users table and I want to query the usernames column. I want > my query to ignore the upper/lower casing. > > So the following searches should all match "John": "john", "jOhn", > "johN, "JOhn", and so on. > > My query at the moment is a follows: > names = query

[sqlalchemy] Re: select() got multiple values for keyword argument 'from_obj'

2007-04-02 Thread Jose Soares
King Simon-NFHD78 ha scritto: > Shouldn't acl.cod_ruolo be inside the [] - part of the first parameter > to 'select'? > > The parameters to select are 'columns=None, whereclause=None, > from_obj=[], **kwargs', so your 'and_' part is going in as the from_obj > parameter, and then you are supplying

[sqlalchemy] select() got multiple values for keyword argument 'from_obj'

2007-04-02 Thread Jose Soares
Hi all, I'm trying to create the following query using SA: SELECT DISTINCT operatore.id, anagrafica.nome, acl.cod_ruolo FROM operatore JOIN anagrafica ON operatore.id_anagrafica = anagrafica.id LEFT OUTER JOIN acl ON acl.id_operatore = operatore.id LEFT OUTER JOIN ruolo_permesso ON ruolo_permess

[sqlalchemy] Re: SELECT 'a fixed string', ...

2007-03-20 Thread jose
Michael Bayer wrote: >use literal_column('fixedstring') in the column clause > > what's the difference between literal and literal_column? literal_column doesn't work for me... NameError: name 'literal_column' is not defined jo >On Mar 19, 2007, at 9:38 AM, Bertrand Croq wrote: > > > >>hi,

[sqlalchemy] Re: SELECT 'a fixed string', ...

2007-03-20 Thread jose
Bertrand Croq wrote: >hi, > >I am currently using sqlalchemy to build SQL queries and it's a fantastic >tool! By now, I am looking for a way to build: > > SELECT 'a_fixed_string', atable.col1, atable.col2 > FROM atable > >using the syntax: > > select([XXX, atable.c.col1, atable.c.col2]) > >but I

[sqlalchemy] Re: use_labels >=30 vs MAX_LABEL_LENGTH

2007-03-16 Thread jose
f the name of a table, or on the number of columns, etc. Indices are similarly unconstrained). >On Mar 16, 2007, at 4:05 PM, Jose Soares wrote: > > > >>Hi Michael, >> >>I see that sql.py uses a limit of 30 characters to create the column >>label when "

[sqlalchemy] Re: error compile

2007-03-16 Thread Jose Soares
Ok, now it works, thank you Michael, jo Michael Bayer ha scritto: > put "correlate=False" in your subquery. > > On Mar 16, 2007, at 12:43 PM, Jose Soares wrote: > > >> Hi, >> Seems that SA compiles in a wrong way my query... >> >> In [9

[sqlalchemy] Re: error compile

2007-03-16 Thread Jose Soares
Sébastien LELONG ha scritto: >> As you can see the from_obj of subselect is wrong, the FROM should be: >> >> FROM azienda_veterinario, unita_aziendale >> > > OK, I see... You probably mean that since your sub-select occurs on two > tables, those have to be present in the FROM clause. I've te

[sqlalchemy] Re: error compile

2007-03-16 Thread Jose Soares
Sébastien LELONG ha scritto: >> Seems that SA compiles in a wrong way my query... >> > > Can't what's wrong is happening... subvet appers to be a sub-select, so > probably SA made some optimizations. You should print the whole query (print > sql) and not the sub-query (as in your code: prin

[sqlalchemy] use_labels >=30 vs MAX_LABEL_LENGTH

2007-03-16 Thread Jose Soares
Hi Michael, I see that sql.py uses a limit of 30 characters to create the column label when "use_labels" is set to True. If name is greater than 30 char long, the label is trunked at position 24 and is appended a random integer to it. Since the name created in this way is less useful, I would l

[sqlalchemy] error compile

2007-03-16 Thread Jose Soares
Hi, Seems that SA compiles in a wrong way my query... In [9]: sql=select([UnitaAziendale.c.id]) In [10]: subvet = select([azienda_veterinario.c.id_unita_aziendale], : and_(azienda_veterinario.c.id_veterinario==3, : azienda_veterinario.c.id_unita_azienda

[sqlalchemy] Re: count function problem

2007-03-15 Thread jose
Glauco wrote: > Michael Bayer ha scritto: > >> >> On Mar 14, 2007, at 12:49 PM, Glauco wrote: >> >>> This is perfect but when i try to use count function the SQL >>> composer try to do an expensive sql. >>> >>> >>> In [63]: print select([tbl['azienda'].c.id], tbl['azienda']).count() >>> *SELEC

[sqlalchemy] Re: SA skips integrity referential?

2007-02-16 Thread jose
Michael Bayer wrote: >On Feb 16, 2007, at 3:46 PM, jose wrote: > > >>No Jonathan, I don't want this column is set as NOT NULL, I have to >>allow null values for this column and I don't want enable the "ON >>DELETE >>SET NULL" funct

[sqlalchemy] Re: SA skips integrity referential?

2007-02-16 Thread jose
jose wrote: >Jonathan Ellis wrote: > > > >>On 2/16/07, jose <[EMAIL PROTECTED]> wrote: >> >> >> >> >>>Jonathan Ellis wrote: >>> >>> >>> >>> >> >> >&

[sqlalchemy] Re: SA skips integrity referential?

2007-02-16 Thread jose
Jonathan Ellis wrote: >On 2/16/07, jose <[EMAIL PROTECTED]> wrote: > > >>Jonathan Ellis wrote: >> >> > > > >>>Guess it would surprise you to learn about the SQL 92 "ON DELETE SET >>>NULL" functionality too. :) &g

[sqlalchemy] Re: SA skips integrity referential?

2007-02-16 Thread jose
Jonathan Ellis wrote: >On 2/16/07, jose <[EMAIL PROTECTED]> wrote: > > >>Gary Bernhardt wrote: >> >> >> >>>Referential integrity isn't being violated here - SA is nulling the >>>foreign key before deleting the row it

[sqlalchemy] Re: SA skips integrity referential?

2007-02-16 Thread jose
y, I'm using autoload to define my tables thus I don't know how to add nullable=False to my tables. jo > > On 2/16/07, *Jose Soares* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > > Hi all, > > I wonder how SA could dele

[sqlalchemy] SA skips integrity referential?

2007-02-16 Thread Jose Soares
Hi all, I wonder how SA could delete a row of my table (postgresql) linked with another table. Take a look... pg=> select * from attivita where cod_specie='33'; codice | descrizione | cod_specie +--

[sqlalchemy] Re: FlushError: Can't change the identity of instance

2007-02-08 Thread jose
svilen wrote: >somehow u've managed to have 2 copies of same persistent-object - >which should not happen; how did u get it? > > I don't know. >one has unicode-string '6', another one has int 6 instead - some >conversion failing? > > what is the best way to remove one of them? session.cle

[sqlalchemy] FlushError: Can't change the identity of instance

2007-02-08 Thread jose
Hi, Could please, someone tell me what the following error means? FlushError: Can't change the identity of instance [EMAIL PROTECTED] in session (existing identity: (, (6,), None); new identity: (, (u'6',), None)) jo --~--~-~--~~~---~--~~ You received this

[sqlalchemy] access mapper properties

2007-02-03 Thread jose
Hi all, I need to iterate the 'dynamic' attributes (properties) as well as simple static ones. this is my table: tariffa( codice text, aliquota_iva text, aliquota_enpav text, centro_costo text, cod_funzione_calcolo text, unita_misura ) This is my mapper: class Tariffa(Do

[sqlalchemy] Re: date format

2007-01-31 Thread jose
Guy Hulbert wrote: >On Wed, 2007-31-01 at 12:17 -0500, Guy Hulbert wrote: > > >>>I would like to display my dates with format '%d/%m/%Y' instead of >>> >>> >>ISO >> >> >>>format. >>> >>>qry = session.query(Nazione).select(Nazione.c.codice=='201') >>>qry[0].data_inizio >>>print qry[0

[sqlalchemy] date format

2007-01-31 Thread Jose Soares
Hi all, I would like to display my dates with format '%d/%m/%Y' instead of ISO format. qry = session.query(Nazione).select(Nazione.c.codice=='201') qry[0].data_inizio print qry[0].data_inizio 2006-01-14 Is there a way to set it in SA without using a customer function ? jo --~--~-

[sqlalchemy] Re: iteration over mapper

2007-01-31 Thread Jose Soares
King Simon-NFHD78 ha scritto: > Jose Soares wrote: > >> Hi all, >> >> Probably this is a stupid question, :-[ but I don't >> understand how to iterate an object mapper to get fields value. >> --- >> >> user = session.query(User).s

[sqlalchemy] iteration over mapper

2007-01-31 Thread Jose Soares
Hi all, Probably this is a stupid question, :-[ but I don't understand how to iterate an object mapper to get fields value. --- user = session.query(User).select(id=1) for j in user.c: print j.name logname id password for j in user.c: print j.value 'Column' object has no attribute

  1   2   >