Trying to find out if I hit a bug or it is me doing something wrong.
Using version 0.4.6
when creating an object and then calling session.save() I get:
Instance 'res...@-0x486e4074' is already persistent
It works save_or_update() with, but I don't see why I should use that.
I did read that
hollister wrote:
# mappers
mapper(Keyphrase, keyphrase_table)
mapper(Action, action_table)
mapper(KeyphraseAction, keyphrase_action_table, properties={
'keyphrase': relation(Keyphrase,
backref = 'keyphrase_action'),
'action': relation(Action),
})
#
Moshe C. wrote:
Trying to find out if I hit a bug or it is me doing something wrong.
Using version 0.4.6
when creating an object and then calling session.save() I get:
Instance 'res...@-0x486e4074' is already persistent
It works save_or_update() with, but I don't see why I should use
Mike, thanks for the quick reply.
I suspected it was a cascade issue, and have been through the docs and
tried various configs. At the risk of appearing stupid, can you point
me in the right direction? Do the cascades only need to be on the
association table, or also on the left right parent
cascades work from the parent that is being deleted or is having a child
removed to the child that is dependent on being attached to its parent.
so in this case Keyphrase-KeyphraseAction and Action-KeyPhraseAction
both in theory need delete, delete-orphan cascade.
In addition you can specify
Thanks.
Given that I am not going to upgrade very soon, is it right to
conclude that there was a bug in 0.4.6, or is my usage wrong?
On Jun 3, 5:28 pm, Michael Bayer mike...@zzzcomputing.com wrote:
Moshe C. wrote:
Trying to find out if I hit a bug or it is me doing something wrong.
Using
Moshe C. wrote:
Thanks.
Given that I am not going to upgrade very soon, is it right to
conclude that there was a bug in 0.4.6, or is my usage wrong?
it is not a bug. save() is used only for transient instances.
On Jun 3, 5:28 pm, Michael Bayer mike...@zzzcomputing.com wrote:
Moshe C.
Hi,
I am working on a TurboGears 2 application that uses SqlAlchemy 0.5.1.
I am using reflection and am having a lot of trouble with it. Anyway,
here's the error I am getting:
Traceback (most recent call last):
File V:\PythonPackages\Development\pyRetention\Scripts\paster-
script.py, line 8,
Well, I thought it was transient.
If you refer to the code in the first post:
If I create a new Resume object and save() it , it works.
If before the save(), I fetch a Workplace object from the DB, then save
() fails and I need to use save_and_update().
So the fact that I queried the DB for a
the MSSQL has had a lot of fixes over the course of 0.5 so definitely get
on the latest 0.5 first.
Mike wrote:
Hi,
I am working on a TurboGears 2 application that uses SqlAlchemy 0.5.1.
I am using reflection and am having a lot of trouble with it. Anyway,
here's the error I am getting:
Moshe C. wrote:
Well, I thought it was transient.
If you refer to the code in the first post:
your first post has a mapping only. There is no illustration of how
you're querying, or using save() or load.
--~--~-~--~~~---~--~~
You received this message
Hello all,
I am new to sqlalchemy and was introduced to it by a project (cjklib)
that uses it. I want to migrate this project to Amazon SimpleDB and
since it makes extensive use of sqlalchemy I thought the best course
of action might be to make a SimpleDB dialect in sqlalchemy which
could
In code:
t = Model.Resume()
t.id = something
w = Model.session.query(Model.Workplace).filter_by(id=idd).first()
# model.save(t)
model.save_or_update(t)
Without the query line, save() would have worked, but the query is on
another object. There is a
Moshe C. wrote:
In code:
t = Model.Resume()
t.id = something
w = Model.session.query(Model.Workplace).filter_by(id=idd).first()
# model.save(t)
model.save_or_update(t)
Without the query line, save() would have worked, but the query is on
another
Weird, the first assertion already fails, but I am not using
ScopedSession.mapper. See the code in the first post.
On Jun 3, 11:28 pm, Michael Bayer mike...@zzzcomputing.com wrote:
easy way to ensure things are working as expected:
Moshe C. wrote:
In code:
t = Model.Resume()
Moshe C. wrote:
Weird, the first assertion already fails, but I am not using
ScopedSession.mapper. See the code in the first post.
On Jun 3, 11:28 pm, Michael Bayer mike...@zzzcomputing.com wrote:
easy way to ensure things are working as expected:
Moshe C. wrote:
In code:
t
full code:
import sqlalchemy as sa
from sqlalchemy import orm
class Model:
session = None
class Person(object):
@staticmethod
def query():
return Model.session.query(Model.Person)
class PersonRelative(object):
@staticmethod
def query():
Hi,
Actually, that was just a placeholder name since I'm not sure that my
employer would like me sticking my tables online. Anyway, the
tablename in Microsoft's Enterprise Manager shows it as being all
lowercase although when I run queries against it in MS Query Analyzer,
it uses all uppercase.
It would be interesting to see if this could be made to work. The
SimpleDB model is rather different from the relational model, so it
would only be useful if your application does not use any advanced
features - no joins etc, each 'domain' might map to one big (albeit
sparse) table.
Laurence
On
that code is fine as far as I can see. if you are still having problems,
produce a test script that can be run by others (this does not qualify
since it uses autoload and does not illustrate the session usage nor the
creation of Model).
Moshe C. wrote:
full code:
import sqlalchemy as sa
i don't see what the purpose of a fake id column serves here. you can
make a Table object and place within it as many actual columns as you
want, including primary key columns. if the table name is truly all
uppercase, then you need to name it that way in the Table object.
Mike Driscoll
The way Simpledb works you don't want to make each domain a table, you
want to put all related tables in one domain. This way you can do
relational queries on the set of objects. One thing that might help
conceptualize it would be to set a table attribute for each item
that contains what the
Let's say I have a many to many relationship as for example in:
orm.mapper(self.Person, person_table, properties = {
'relatives' : orm.relation(self.Person,
secondary=person_relative_table,
primaryjoin=person_table.c.id==person_relative_table.c.person_id,
Is there a (public) API for getting the column names of a given Query
instance and other similar introspection needs ? I didn't find
anything related in the docs but after digging in the code I came up
with
col_names = [e._result_label for e in q._entities]
but I'm not sure how stable and
each row has a keys() attribute if that helps...
On Jun 3, 2009, at 8:49 PM, George Sakkis wrote:
Is there a (public) API for getting the column names of a given Query
instance and other similar introspection needs ? I didn't find
anything related in the docs but after digging in the code
Hello,
I'm using sqlite and convert_unicode = True on the engine.
How can I force coerce string based object attributes in to unicode?
(I had thought convert_unicode = True would do this)
Here is what I am seeing...
Setup code:
engine = create_engine('sqlite:///:memory:', echo=True,
26 matches
Mail list logo