[sqlalchemy] Re: how to assign values to columns of a mapper?

2006-12-19 Thread Michael Bayer

at this point you need to produce a full example that reproduces your
issue.


--~--~-~--~~~---~--~~
 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: how to assign values to columns of a mapper?

2006-12-18 Thread robert rottermann
Michael Bayer wrote:
 the error message indicates that there is more than one Session in
 play.  a big reason for this is that people have import
 sqlalchemy.ext.threadlocal lying around when they dont really want
 that.
   
thanks for the hint,

I do not use threadlocal in any direct way but I am using sqlsoup.
I tried to subclass sqlsoup and handle all the engine/metadata/session
handling
trough it but I still have the same error.

What I am doing is creating the engine two times. The first time I
create a database
the second time I am using the database. could this be the problem?

I am using the following method to do it:
def _checkEngine(self):
if self._connectioninfo.has_key('dbname'):
connectionstr = '%(engine)s%(user)s:%(pw)s/%(dbname)s' %
self._connectioninfo
else:
connectionstr = '%(engine)s%(user)s:%(pw)s' %
self._connectioninfo
if self._db is None:
self._dbengine = create_engine(connectionstr)
self._metadata = BoundMetaData(self._dbengine)
self._db = RedSoup(self._metadata)
self._db._metadata.engine.echo = True

After creating the database I adapt self._connectioninfo, set self._db
to None to force
and call _checkEngine().
do I have to explicitly clean/close a session or BoundMetadata?

thanks
robert
 


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---
begin:vcard
fn:robert  rottermann
n:rottermann;robert 
email;internet:[EMAIL PROTECTED]
tel;work:031 333 10 20
tel;fax:031 333 10 23
tel;home:031 333 36 03
x-mozilla-html:FALSE
version:2.1
end:vcard



[sqlalchemy] Re: how to assign values to columns of a mapper?

2006-12-16 Thread Robin Munn

On 12/16/06, robert rottermann [EMAIL PROTECTED] wrote:
 now I would like to do something like:
 data = readExcelsheet(xx)
 for newRec in data:
 for fname, fvalue in newRec.items():
mapper.c[fname] = fvalue
session.save(mapper)
 session.flush()

Each time through the loop, you're assigning new values to the columns
of the *same* object here. I think that may be what's causing your
problem. Try creating a new instance each time through the for newRec
in data: loop and see if the problem goes away.

-- 
Robin Munn
[EMAIL PROTECTED]
GPG key 0x4543D577

--~--~-~--~~~---~--~~
 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: how to assign values to columns of a mapper?

2006-12-16 Thread Robin Munn

On 12/16/06, robert rottermann [EMAIL PROTECTED] wrote:
 more ideas ?
 robert

I've run out of ideas.

It might be better to show us snippets from the real code, rather than
the pseudocode. As it is, we're just guessing about what your code
looks like. And if the pseudocode you showed doesn't precisely
correspond to the real code (as with the creating a new mapper issue I
thought I'd spotted), that makes it even worse. I doubt anyone else
will be able to figure out your problem based on what you've given us
so far. (Although you never know, someone might surprise me).

-- 
Robin Munn
[EMAIL PROTECTED]
GPG key 0x4543D577

--~--~-~--~~~---~--~~
 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: how to assign values to columns of a mapper?

2006-12-16 Thread Michael Bayer

the error message indicates that there is more than one Session in
play.  a big reason for this is that people have import
sqlalchemy.ext.threadlocal lying around when they dont really want
that.


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---