Re: [sqlalchemy] reflection failure with MySQL: Mapper could not assemble any primary key columns for mapped table

2013-03-12 Thread Felix Schwarz
Am 11.03.2013 17:27, schrieb Michael Bayer: OK well that table has no primary key established. I see. So even if MySQL tells me (in 'show fields') that a column is a primary key, SQLAlchemy won't recognize it unless the column is explicitely marked as primary key (as opposed to a unique key).

[sqlalchemy] advices

2013-03-12 Thread Julien Cigar
Hello, I have written a CMS which is, among other, based on the joined load inheritance feature of SQLAlchemy. It is quite simple: the user is able to add objects in containers and can select the default polymorphic loading for a container. In gross it can dynamically select which tables

[sqlalchemy] Question PickledType usage

2013-03-12 Thread Zoltan Giber
Hi, I'm new to sqlalchemy, writing my first app using it. I stumbled upon a weird thing; my user object has a pyckletype representing a python dict, which i can't find a way to update. I assumed, that a change in the pickled object will somehow trigger dirty and my new data should be there,

Re: [sqlalchemy] Question PickledType usage

2013-03-12 Thread Matthew Desmarais
Hi Zoltan, On Tue, Mar 12, 2013 at 9:56 AM, Zoltan Giber zgi...@gmail.com wrote: I'm new to sqlalchemy, writing my first app using it. I stumbled upon a weird thing; my user object has a pyckletype representing a python dict, which i can't find a way to update. I assumed, that a change in

Re: [sqlalchemy] reflection failure with MySQL: Mapper could not assemble any primary key columns for mapped table

2013-03-12 Thread Michael Bayer
On Mar 12, 2013, at 6:32 AM, Felix Schwarz felix.schw...@oss.schwarz.eu wrote: Am 11.03.2013 17:27, schrieb Michael Bayer: OK well that table has no primary key established. I see. So even if MySQL tells me (in 'show fields') that a column is a primary key, SQLAlchemy won't recognize

Re: [sqlalchemy] Question PickledType usage

2013-03-12 Thread Zoltan Giber
Thanks Matthew, I see that this would be a way, but I'm not very experienced, and introducing a new custom type feels like an overkill. I only have three pickletype in my whole app, and i don't mind to set dirty manually when I update them. I don't want to query against their values either.

Re: [sqlalchemy] Question PickledType usage

2013-03-12 Thread Michael Bayer
if you want to do this manually, just reassign to the attribute which will trigger it: myobject.mypickle = {dictionary} the mutation thing is only if you want in-place tracking, that is: myobject.mypickle['newvalue'] = 'something' On Mar 12, 2013, at 11:15 AM, Zoltan Giber zgi...@gmail.com

[sqlalchemy] Problem with __declare_last__ and inheritance

2013-03-12 Thread peeters . martin
I've encounter an error today when I've try to inherit from a mixin who implements the __declare_last__ method on a mapper that defines also the __declare_last__ method. Here's what my code looks like: class Mixin(object): @classmethod def __declare_last__(cls):

Re: [sqlalchemy] Question PickledType usage

2013-03-12 Thread Zoltan Giber
Thanks Michael, that did the trick. Using the mutable thing is only a small comfort in my case compared to the extra design it takes. for the sake of completeness here is what works: newuser = User(email,name,password) newuser.notebooks.append(Notebook(My Notes))

[sqlalchemy] Ignoring declarative inheritance joins

2013-03-12 Thread chris . r . mcguire
Hi all, What is the best way to avoid querying the base table in an joined table inheritance? For instance with a class setup like: class A(Base): __tablename__ = 'table_a' id = Column(Integer, primary_key=True) name = Column(String(50)) class B(A): __tablename__ =

Re: [sqlalchemy] Ignoring declarative inheritance joins

2013-03-12 Thread Michael Bayer
On Mar 12, 2013, at 4:50 PM, chris.r.mcgu...@gmail.com wrote: Hi all, What is the best way to avoid querying the base table in an joined table inheritance? For instance with a class setup like: class A(Base): __tablename__ = 'table_a' id = Column(Integer,