I guess the simplest solutions are often the best… Turns out this actually
works flawlessly (from what I’ve been able to tell so far), I didn’t expect
SQLAlchemy to be smart enough to figure it out so I never even tried it this
simple…
Thanks!
> On 23 Mar 2019, at 20:04, Mike Bayer wrote:
>
On Sat, Mar 23, 2019 at 12:39 PM 02JanDal wrote:
>
> Hello,
>
> I have two simple inheritance trees using joined table inheritance, see code
> below. In short, MembershipType inherits BaseShopItem and Membership inherits
> TransactionItem and there is a one-to-many relationship between
Hello,
I have two simple inheritance trees using joined table inheritance, see
code below. In short, MembershipType inherits BaseShopItem and Membership
inherits TransactionItem and there is a one-to-many relationship between
BaseShopItem and TransactionItem.
This works well, but now I want
I'm using sqlalchemy 0.8.7 on python 2.7.8.
Here is my test case:
#!/usr/bin/env python
from sqlalchemy import Column, ForeignKey
from sqlalchemy.orm import relationship, backref
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.dialects.postgresql import *
On 31 Jul 2014, at 21:34, Rick Otten rottenwindf...@gmail.com wrote:
I'm using sqlalchemy 0.8.7 on python 2.7.8.
Here is my test case:
#!/usr/bin/env python
from sqlalchemy import Column, ForeignKey
from sqlalchemy.orm import relationship, backref
from sqlalchemy.ext.declarative
That ForeignKey definition looks wrong - it should point at a column, not
a class. I think you want:
ForeignKey(parent.parent_id)
Interesting, thanks, in the case where I use the same 'Base' for both
classes, that solves it. In PostgreSQL the column definition isn't
required if
I have been struggeling for a few days with this now and trying to see
if I maybe can get some help here. I'm using SQLAlchemy with Flask
This is what I have tried so far:
I got a user class defined like this:
association_table = db.Table('association',
db.Column('user_id', db.Integer,