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
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.
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?
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
jose.soa...@sferacarta.com wrote:
Hi all,
While I changed some obsolete syntax as defined in
(https
(Rischio.c.peso_gruppo
== sa.**sql.true()**)*
:)
On 03/30/2015 10:52 AM, Jose Soares wrote:
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
jose.soa
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),
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
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
Hi all,
I have a query generated by sqlalchemy like this:
SELECT fattura_master.tipo_documento AS fattura_master_tipo_documento,
fattura_master.sezionale || '/' || CAST(fattura_master.anno AS
VARCHAR(None CHAR)) || '/' || CAST(fattura_master.numero AS VARCHAR(None
CHAR)) AS pk FROM
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 jose.soa...@sferacarta.com wrote:
Hi all,
I have a query generated by sqlalchemy like this:
SELECT fattura_master.tipo_documento AS fattura_master_tipo_documento
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
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,34,2]
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
jose.soa...@sferacarta.com 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
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'),
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:
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=oracle
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
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
): #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 your script.
the cx_Oracle.connect, works but
the create_engine doesn't
)
)
)
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't.
def init_db_conn(parms): #this work
import
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
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
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 there
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\nLINE
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, in
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
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
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
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 script I try
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 how commit
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
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('original') class
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
Yes, it works, :-)
Thank you Simon,
j
King Simon-NFHD78 wrote:
Jo wrote:
Thank you for replay my question, Simon,
but I can't find the 'original' state there.
j
Here's an example that shows the results of the get_history function:
#
import sqlalchemy as sa
import
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
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 14 apr, 13:16, jose
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,
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:
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 the Column
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
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)
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 =
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
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
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
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: print
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 tested this
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
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
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
Jose Soares ha scritto:
Michael Bayer ha scritto:
not sure about that, i thought maybe the multiple flush()es are
breaking something but I just added a test case and it doesnt
reproduce. make sure youre on the most recent versions since that was
broken a few versions back
Hi all,
I would like to know how the postgresl serial type field works in sa?
SA doesn't increment the serial column if of my group_permission table:
gp=GroupPermission()
for x in Permission.select():
gp.cod_ruolo = 'sysadmin'
gp.cod_permesso = x.codice
session.save(gp)
print
INTO (cod_ruolo, cod_permesso ) VALUES (%(cod_ruolo)s,
%(cod_permesso)s);
because it is a postgresql responsability to assign value to id where
serial is triggered.
jo
Jose Soares ha scritto:
Hi all,
I would like to know how the postgresl serial type field works in sa?
SA doesn't increment
I think I have a similar trouble, although the symptoms are different.
I have a PostgreSQL table named 'acl' mapped as UserGroup.
Table acl
Column| Type
--+-
id | integer
id_operatore | integer
cod_ruolo| text
id_asl | integer
id_azienda
Hello Michael,
the query is perfect, with every JOIN and LEFT JOIN,
thank you very much.
jo
Michael Bayer ha scritto:
hey jose -
was waiting to see if anyone jumped on this for you. alas, no
responses.
making some assumptions about your Table objects, your query above
would look something
Robin Munn ha scritto:
Maybe this is in the documentation, but if so, I've missed it.
I'd like to do something like the stmt = users.select();
stmt.append_whereclause(...) example found in
http://www.sqlalchemy.org/docs/sqlconstruction.myt#sql_building , but
using a Query object taken from
Great!
jo
Michael Bayer ha scritto:
we have case():
select(case([(table.c.x==5, 5), (table.c.y==7, 12)], else_=7))
and cast():
select([cast(table.c.x, Numeric)])
which are in the generated documentation for sql.py.
for coalesce() you can call that as func.coalesce() for now.
57 matches
Mail list logo