Re: [sqlalchemy] Relationship setup

2014-05-11 Thread Michael Bayer
On May 11, 2014, at 12:27 AM, Joseph Casale jcas...@gmail.com wrote: What I wanted to know was if it was possible to construct either a table definition for TableB so that someone could simply pass in actual values of table_a.name to meta columns in table_b. For example if #3 above is

Re: [sqlalchemy] Relationship setup

2014-05-11 Thread Joseph Casale
Hey Michael, I really appreciate all that, it was extremely informative. For the academic sake I have this extrapolated to include all the actual intermediate tables that TableB would include. For the academic sake, without the mixin and proxy, given a traditional approach where TableA is

Re: [sqlalchemy] Relationship setup

2014-05-11 Thread Michael Bayer
On May 11, 2014, at 4:28 PM, Joseph Casale jcas...@gmail.com wrote: Hey Michael, I really appreciate all that, it was extremely informative. For the academic sake I have this extrapolated to include all the actual intermediate tables that TableB would include. For the academic sake,

[sqlalchemy] Relationship setup

2014-05-10 Thread Joseph Casale
I have about a dozen tables with an id PK column and a single column with some unique string. I then have a single table that composes 13 rows with an id PK field and all FK refs to rows in the other 12 tables. Bulk inserting data into the initial 12 tables is simple but I am not certain how to

Re: [sqlalchemy] Relationship setup

2014-05-10 Thread Michael Bayer
On May 10, 2014, at 3:34 PM, Joseph Casale jcas...@gmail.com wrote: I have about a dozen tables with an id PK column and a single column with some unique string. I then have a single table that composes 13 rows with an id PK field and all FK refs to rows in the other 12 tables. Bulk

Re: [sqlalchemy] Relationship setup

2014-05-10 Thread Joseph Casale
Hey Michael, Lets say I have a table TableA: class TableA(Base): __tablename__ = 'table_a' id = Column(Integer, primary_key=True) name = Column(String(collation='nocase'), unique=True, nullable=False) Then TableB: class TableB(Base): __tablename__ = 'table_b' id =

Re: [sqlalchemy] Relationship setup

2014-05-10 Thread Michael Bayer
On May 10, 2014, at 11:58 PM, Joseph Casale jcas...@gmail.com wrote: Hey Michael, Lets say I have a table TableA: class TableA(Base): __tablename__ = 'table_a' id = Column(Integer, primary_key=True) name = Column(String(collation='nocase'), unique=True, nullable=False)

Re: [sqlalchemy] Relationship setup

2014-05-10 Thread Joseph Casale
I don’t understand. Do you mean at the configuration level? e.g.: class TableB(Base): # … name = relationship(TableA) # “name_id” is auto created? Right, So when a person is adding rows to TableB, they have a few ways of doing it. 1. If they know or lookup the actual PK

Re: [sqlalchemy] Relationship setup problem

2013-04-09 Thread Michael Bayer
1. is Winracku.combrack intended to be many-to-one or one-to-many ? 2. Given w1, w2: w1 = Winracku() w2 = Winracku() w1.combrack = w2 which one are you deleting first, and what is the desired behavior as a result? On Apr 9, 2013, at 8:29 AM, Werner werner.bru...@sfr.fr wrote: On

Re: [sqlalchemy] Relationship setup problem

2013-04-09 Thread Werner
On 09/04/2013 14:29, Werner wrote: ... Wineracku.combrack = sao.relationship('Wineracku', remote_side=[Wineracku.id], cascade=all, delete, delete-orphan, single_parent=True) Wineracku.combrack =

Re: [sqlalchemy] Relationship setup problem

2013-04-09 Thread Werner
Hi Michael, Didn't see this one before my last post. On 09/04/2013 16:19, Michael Bayer wrote: 1. is Winracku.combrack intended to be many-to-one or one-to-many ? One to many, in other words just to make sure that I don't mess up terminology, w1 can have many children but the children only

Re: [sqlalchemy] Relationship setup problem

2013-04-09 Thread Michael Bayer
On Apr 9, 2013, at 10:27 AM, Werner werner.bru...@sfr.fr wrote: Hi Michael, Didn't see this one before my last post. On 09/04/2013 16:19, Michael Bayer wrote: 1. is Winracku.combrack intended to be many-to-one or one-to-many ? One to many, in other words just to make sure that I don't

[sqlalchemy] Relationship setup problem

2013-03-01 Thread Werner
Hi, I have an ORM class: class Wineracku(DeclarativeBase, mix.StandardColumnMixin): __tablename__ = u'wineracku' description = sa.Column(sa.Unicode(length=30)) shortdesc = sa.Column(sa.Unicode(length=10)) # only used with single bottle type units maxcol =

Re: [sqlalchemy] Relationship setup problem

2013-03-01 Thread Werner
Hi, Found it in the doc, the Adjacency List Relationship is what I wanted. http://docs.sqlalchemy.org/en/latest/orm/relationships.html#adjacency-list-relationships Werner -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this