Re: [sqlalchemy] Problem with Joined Table inheritance

2010-07-13 Thread Stefano Bartaletti
 class ArkWebVideoWidget(object):

should be

 class ArkWebVideoWidget(ArkWebWidget):

--
Beauty is a pair of shoes that makes you wanna die

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



[sqlalchemy] Re: Empty inserts and objects with no attributes

2009-10-06 Thread Stefano Bartaletti

 A class of mine has no attributes besides its primary key.  This key
 is a surrogate, so I'd like to assign values automatically via
 autoincrement.  Unfortunately, it's not possible to persist objects of
 this class to the database, as the SQL compiler complains about empty
 inserts.  Is there a common workaround for this?


Sure

http://www.sqlalchemy.org/docs/05/metadata.html#ddl-level-defaults

http://www.sqlalchemy.org/docs/05/metadata.html#defining-sequences

-- 
Jazz is not dead, it just smells funny

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Filtering a polymorphic with 'any'

2009-05-22 Thread Stefano Bartaletti

Hi,

I am trying the following:

import sqlalchemy as sqa
from sqlalchemy import orm

engine = sqa.create_engine(sqlite://, echo=True)
meta = sqa.MetaData(bind=engine)

Session = orm.scoped_session(orm.sessionmaker(bind=engine, 
autocommit=True,autoflush=False))

tab = sqa.Table(test, meta, 
sqa.Column(poly, sqa.Integer),
sqa.Column(id, sqa.Integer, primary_key=True),
sqa.Column(parent, sqa.Integer, sqa.ForeignKey(test.id)),
sqa.Column(other, sqa.Integer, sqa.ForeignKey(test.id)),
)
meta.create_all()

class C1(object):
pass
class C2(C1):
pass

Session.mapper(C1, tab, polymorphic_on=tab.c.poly, polymorphic_identity=0, 
properties={
children: orm.relation(C2, primaryjoin=tab.c.parent==tab.c.id), 
})
Session.mapper(C2, inherits=C1, polymorphic_identity=1)

print C1.query.filter(C1.children.any()).all()

the print statement gives me

AttributeError: 'ClauseList' object has no attribute 'proxy_set'

Where am I wrong?

-- 
Jazz is not dead, it just smells funny (FZ)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Filtering a polymorphic with 'any'

2009-05-22 Thread Stefano Bartaletti

Hi,

I am trying the following:

import sqlalchemy as sqa
from sqlalchemy import orm

engine = sqa.create_engine(sqlite://, echo=True)
meta = sqa.MetaData(bind=engine)

Session = orm.scoped_session(orm.sessionmaker(bind=engine, 
autocommit=True,autoflush=False))

tab = sqa.Table(test, meta, 
sqa.Column(poly, sqa.Integer),
sqa.Column(id, sqa.Integer, primary_key=True),
sqa.Column(parent, sqa.Integer, sqa.ForeignKey(test.id)),
sqa.Column(other, sqa.Integer, sqa.ForeignKey(test.id)),
)
meta.create_all()

class C1(object):
pass
class C2(C1):
pass

Session.mapper(C1, tab, polymorphic_on=tab.c.poly, polymorphic_identity=0, 
properties={
children: orm.relation(C2, primaryjoin=tab.c.parent==tab.c.id), 
})
Session.mapper(C2, inherits=C1, polymorphic_identity=1)

print C1.query.filter(C1.children.any()).all()

the print statement gives me

AttributeError: 'ClauseList' object has no attribute 'proxy_set'

Where am I wrong?

-- 
Jazz is not dead, it just smells funny (FZ)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] AttributeError migrating to 0.4.6

2008-07-16 Thread Stefano Bartaletti

Hello list,

I recently installed 0.4.6 and I got this dump:

Traceback (most recent call last):
  File /media/userdata/stefano/Documenti/projects/Tosi/erp/login.py, line 85, 
in onCheckUtente
    self.checkUtente(self.inputUser.GetValue().lower())
  File /media/userdata/stefano/Documenti/projects/Tosi/erp/login.py, line 64, 
in checkUtente
    user = mapperFunctions.getUtente(user)
  File 
/media/userdata/stefano/Documenti/projects/Tosi/erp/dyemagic2/mapperFunctions.py,
 line 19, in getUtente
    rep = mappers.Reparto.query.first() #Per inizializzare la sessione
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/orm/scoping.py,
 line 144, in __getattr__
    return getattr(self.context.registry().query(class_), key)
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/orm/session.py,
 line 895, in query
    return self._query_cls(entities, self, **kwargs)
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/orm/query.py,
 line 97, in __init__
    self.__setup_aliasizers(self._entities)
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/orm/query.py,
 line 111, in __setup_aliasizers
    mapper, selectable, is_aliased_class = _entity_info(entity, ent.entity_name)
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/orm/util.py,
 line 398, in _entity_info
    mapper = class_mapper(entity, entity_name, compile)
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/orm/util.py,
 line 488, in class_mapper
    mapper = mapper.compile()
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/orm/mapper.py,
 line 368, in compile
    mapper.__initialize_properties()
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/orm/mapper.py,
 line 389, in __initialize_properties
    prop.init(key, self)
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/orm/interfaces.py,
 line 378, in init
    self.do_init()
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/orm/properties.py,
 line 514, in do_init
    self._post_init()
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/orm/properties.py,
 line 750, in _post_init
    super(PropertyLoader, self).do_init()
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/orm/interfaces.py,
 line 548, in do_init
    self.strategy = self.__init_strategy(self.strategy_class)
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/orm/interfaces.py,
 line 537, in __init_strategy
    strategy.init()
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/orm/strategies.py,
 line 339, in init
    self.logger.info(%s lazy loading clause %s % (self, self.__lazywhere))
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/sql/expression.py,
 line 1155, in __str__
    return unicode(self.compile()).encode('ascii', 'backslashreplace')
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/sql/expression.py,
 line 1151, in compile
    compiler.compile()
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/sql/compiler.py,
 line 175, in compile
    self.string = self.process(self.statement)
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/sql/compiler.py,
 line 183, in process
    return meth(obj, **kwargs)
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/sql/compiler.py,
 line 377, in visit_binary
    return self.process(binary.left) +   + op +   + 
self.process(binary.right)
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/sql/compiler.py,
 line 183, in process
    return meth(obj, **kwargs)
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/sql/compiler.py,
 line 227, in visit_grouping
    return ( + self.process(grouping.element) + )
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/sql/compiler.py,
 line 183, in process
    return meth(obj, **kwargs)
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/sql/compiler.py,
 line 507, in visit_select
    for co in select.inner_columns
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0beta2-py2.5.egg/sqlalchemy/sql/compiler.py,
 line 463, in label_select_column
    return column.label(column.anon_label)
AttributeError: '_BindParamClause' object has no attribute 'anon_label'

In my database I made a weird combination with vertical tables that maybe fired 
this, and I thought that not EVERY case is always tested
(had a hard time in my first sqa tests few months ago trying to make the 
vertical example work as I wished with postgres)

[sqlalchemy] Bug in 0.4.6/0.5 ?

2008-07-15 Thread Stefano Bartaletti
)) 
and (not hasattr(column, 'name') or isinstance(column, sql._Function)):
changed to:
elif not isinstance(column, (sql._UnaryExpression, sql._TextClause, 
sql._BindParamClause)) and (not hasattr(column, 'name') or isinstance(column, 
sql._Function)):

works fine after this change (I can imagine what I did but just imagine heh)

-- 
Cordialmente

Stefano Bartaletti
Responsabile Software

G.Tosi Spa Tintoria

Skype account: stefano.bartaletti
ICQ contact  : 1271960

Viale dell'Industria 61
21052 Busto Arsizio (VA)

Tel. +39 0331 34 48 11
Fax  +39 0331 35 21 23

-
Prima di stampare questo messaggio, assicuratevi che sia VERAMENTE necessario.

Il futuro dell'ambiente (e quindi il nostro) e' nelle mani (e nella testa) di 
tutti!
-- 
Cordialmente

Stefano Bartaletti
Responsabile Software

G.Tosi Spa Tintoria

Skype account: stefano.bartaletti
ICQ contact  : 1271960

Viale dell'Industria 61
21052 Busto Arsizio (VA)

Tel. +39 0331 34 48 11
Fax  +39 0331 35 21 23

-
Prima di stampare questo messaggio, assicuratevi che sia VERAMENTE necessario.

Il futuro dell'ambiente (e quindi il nostro) e' nelle mani (e nella testa) di 
tutti!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Bug in 0.4.6/0.5 ?

2008-07-15 Thread Stefano Bartaletti
, 'name') or isinstance(column, sql._Function)):
changed to:
elif not isinstance(column, (sql._UnaryExpression, sql._TextClause, 
sql._BindParamClause)) and (not hasattr(column, 'name') or isinstance(column, 
sql._Function)):

works fine after this change (I can imagine what I did but just imagine heh)

-- 
Cordialmente

Stefano Bartaletti
Responsabile Software

G.Tosi Spa Tintoria

Skype account: stefano.bartaletti
ICQ contact  : 1271960

Viale dell'Industria 61
21052 Busto Arsizio (VA)

Tel. +39 0331 34 48 11
Fax  +39 0331 35 21 23

-
Prima di stampare questo messaggio, assicuratevi che sia VERAMENTE necessario.

Il futuro dell'ambiente (e quindi il nostro) e' nelle mani (e nella testa) di 
tutti!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Question: mapping a complex SQL instruction as a relation

2008-01-31 Thread Stefano Bartaletti

Alle lunedì 28 gennaio 2008, Michael Bayer ha scritto:
 this example is the working version of what's in ticket #948.  a few
 other combinations of the above are not yet working, namely if you
 tried using lazy=True, or if you put an explicit correlate(users) on
 the stuff_view selectable.

 theres other ways to do this too, like not using the correlation to
 items and instead joining to a view of all the max(date_start)s,
 though that tends to produce less efficient queries (but also work
 better with SQLAlchemy at the moment).

Interesting... I think I will wait for some version update and see. At this 
moment these optimizations are not crucial for my application

Thanks!

-- 
Cordialmente

Stefano Bartaletti
Responsabile Software

G.Tosi Spa Tintoria

Skype account: stefano.bartaletti
ICQ contact  : 1271960

Viale dell'Industria 61
21052 Busto Arsizio (VA)

Tel. +39 0331 34 48 11
Fax  +39 0331 35 21 23 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Question: mapping a complex SQL instruction as a relation

2008-01-28 Thread Stefano Bartaletti

Hello,

I have two tables defined this way:

tabItems = sqa.Table(meta, items,
sqa.Column(id, sqa.Integer, primary_key=True),
)
tabTracking = sqa.Table(meta, tracking,
sqa.Column(id, sqa.Integer, primary_key=True),
sqa.Column(item_id, sqa.Integer, sqa.ForeignKey(items.id)),
sqa.Column(date_start, sqa.DateTime, default=now),
sqa.Column(date_end, sqa.DateTime, default=infinity),
)

Now I would like the Item mapper to automagically get the last Tracking 
record (through MAX() on date_start field)

In SQL should be:

select items.*, tracking.*
from items
left join tracking on
tracking.item_id=items.id
and tracking.date_start = (
select max(date_start) 
from tracking t1 
where t1.item_id=tracking.item_id
)

Is it possible to write a relation() to perform such a task at mapper level?

-- 
Cordialmente

Stefano Bartaletti
Responsabile Software

G.Tosi Spa Tintoria

Skype account: stefano.bartaletti
ICQ contact  : 1271960

Viale dell'Industria 61
21052 Busto Arsizio (VA)

Tel. +39 0331 34 48 11
Fax  +39 0331 35 21 23 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Problem (bug?) with flush after upgrading to 0.4

2008-01-09 Thread Stefano Bartaletti

Hello ,

I've built a database with Postgres and some ideas taken from the vertical 
tables example, and I stumbled on two problems that I think could be bugs
In my code I need to get all row IDs from new/mod/del objects, so I added an 
extension working out objects attached to a session

When I perform flush(), I get this dump:

Traceback (most recent call last):
  File importMonitor.py, line 209, in run
self.importDyeMagic.check()
  File importMonitor.py, line 190, in check
fun(funData)
  File /home/stefano/documenti/projects/sqlalchemy/importFunctions.py, line 
48, in _sqlalchemyWrapper
result = fn(*args, **kwargs)
  File /home/stefano/documenti/projects/sqlalchemy/importFunctions.py, line 
637, in importDdtGreggi
importMagazzinoGreggi(__ddtCliente ,**kwargs)
  File /home/stefano/documenti/projects/sqlalchemy/importFunctions.py, line 
685, in importMagazzinoGreggi
importArticoli(articoli, **kwargs)
  File /home/stefano/documenti/projects/sqlalchemy/importFunctions.py, line 
49, in _sqlalchemyWrapper
session.flush()
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.4.2b-py2.5.egg/sqlalchemy/orm/scoping.py,
 line 74, in do
return getattr(self.registry(), name)(*args, **kwargs)
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.4.2b-py2.5.egg/sqlalchemy/orm/session.py,
 line 693, in flush
self.uow.flush(self, objects)
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.4.2b-py2.5.egg/sqlalchemy/orm/unitofwork.py,
 line 184, in flush
session.extension.before_flush(session, flush_context, objects)
  File /home/stefano/documenti/projects/sqlalchemy/databaseExtension.py, line 
115, in before_flush
self.changes.storeInfo(session)
  File /home/stefano/documenti/projects/sqlalchemy/databaseExtension.py, line 
25, in storeInfo
operations = {INS:session.new, MOD:session.dirty, DEL:session.deleted}
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.4.2b-py2.5.egg/sqlalchemy/orm/session.py,
 line 1102, in dirty
return self.uow.locate_dirty()
  File 
/usr/lib/python2.5/site-packages/SQLAlchemy-0.4.2b-py2.5.egg/sqlalchemy/orm/unitofwork.py,
 line 161, in locate_dirty
or (x.__class__._class_state.has_mutable_scalars and x.state.is_modified())
AttributeError: '_valore' object has no attribute 'state'

I've checked the source and to me end of line 161 should be and 
x._state.is_modified())

Please advise, thanks

-- 
Cordialmente

Stefano Bartaletti
Responsabile Software

G.Tosi Spa Tintoria

Skype account: stefano.bartaletti
ICQ contact  : 1271960

Viale dell'Industria 61
21052 Busto Arsizio (VA)

Tel. +39 0331 34 48 11
Fax  +39 0331 35 21 23 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] SessionExtension and Transactions: how to coordinate all SessionExtension funcs

2007-12-10 Thread Stefano Bartaletti

Foreword: sqlalchemy is really amazing!

Hello,

I'm trying to build a database where users become aware of what has been 
changed by other users: there is a SessionExtension that collects info about 
changes and then dispatch some messages with a Pyro Event Server.

I'm trying to understand what can be my link point between flush, commit and 
rollback operations to store the single IDs into a per-transaction dictionary 
and then, when there is a commit on a non-nested transaction, gather all and 
dispatch the message through Pyro

I thought I could use id(session.transaction) as a dictionary key, but 
- it changes between before_flush and after_flush
- remains the same between before_flush, after_commit and rollback

I need to gather IDs in after_commit because theID is a serial Postgres value 
that is available only after flush()

The only correct link I found it in an obscure (to me) 
_SessionTransaction__parent, so I suspect this is not the correct way to 
get to my goal. Is there a cleaner way to do such a thing?

Thanks in advance, here is some code:

in mySessionExtension I put:
def after_rollback(self, session):
print after_rollback, id(session.transaction)

def after_commit(self, session):
print after_commit, id(session.transaction)

def before_flush(self, session, flush_context, objects):
print before_flush, id(session.transaction)

def after_flush(self, session, flush_context):
print after_flush, id(session.transaction), 
id(session.transaction._SessionTransaction__parent)

In the main I made:

ss.begin()
rep = dict((x.codice, x) for x in mappers.Reparto.query.all())
r = rep['3']
r.descrizione += '!'
ss.flush()
if 1:
ss.begin_nested()
r = rep['2']
r.descrizione += '!'
ss.flush()
ss.rollback()
ss.commit()

The resulting dump was
before_flush 147722732
after_flush 149425612 147722732
before_flush 149423788
after_flush 149489964 149423788
after_rollback 149423788
after_commit 147722732

I'm working with Python 2.5, SQA 0.4.1 with scoped_session 
(transactional=False, autoflush=False)

Thanks

-- 
Cordialmente

Stefano Bartaletti
Responsabile Software

G.Tosi Spa Tintoria

Skype account: stefano.bartaletti
ICQ contact  : 1271960

Viale dell'Industria 61
21052 Busto Arsizio (VA)

Tel. +39 0331 34 48 11
Fax  +39 0331 35 21 23 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: SessionExtension and Transactions: how to coordinate all SessionExtension funcs

2007-12-10 Thread Stefano Bartaletti

 The only correct link I found it in an obscure (to me)
 _SessionTransaction__parent, so I suspect this is not the correct way to
 get to my goal. Is there a cleaner way to do such a thing?

Just one thing: I know the syntax _class__attribute to access hidden python 
attirbutes, obscure is the way I'm trying to use this, is it good or not? :-)

-- 
Cordialmente

Stefano Bartaletti
Responsabile Software

G.Tosi Spa Tintoria

Skype account: stefano.bartaletti
ICQ contact  : 1271960

Viale dell'Industria 61
21052 Busto Arsizio (VA)

Tel. +39 0331 34 48 11
Fax  +39 0331 35 21 23 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: SessionExtension and Transactions: how to coordinate all SessionExtension funcs

2007-12-10 Thread Stefano Bartaletti

Alle lunedì 10 dicembre 2007, Marco Mariani ha scritto:
 Stefano Bartaletti wrote:
  I need to gather IDs in after_commit because theID is a serial Postgres
  value that is available only after flush()

 Not really... in postgres, you can ask to consume the next sequence
 value with SELECT NEXTVAL('sequence_name') and explicitly set that as
 primary key value.

Thanks I already thougt of this solution, but if I need to do the same for 
different attributes that are not valued until flush I'm in trouble again

-- 
Cordialmente

Stefano Bartaletti
Responsabile Software

G.Tosi Spa Tintoria

Skype account: stefano.bartaletti
ICQ contact  : 1271960

Viale dell'Industria 61
21052 Busto Arsizio (VA)

Tel. +39 0331 34 48 11
Fax  +39 0331 35 21 23 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---