[sqlalchemy] Elixir question

2012-02-03 Thread lars van gemerden
Hi, I am trying to sote pairs in a table as follows: #-- from elixir import * metadata.bind = sqlite:///:memory: metadata.bind.echo = False class Pairs(Entity): name = Field(String(50), primary_key = True)

[sqlalchemy] Re: Elixir question

2012-02-03 Thread lars van gemerden
I should probably make the pair method: def pair(name1, name2): p1, p2 = Pairs(name1), Pairs(name2) p1.other = p2 p2.other = p1 On Feb 3, 11:57 am, lars van gemerden l...@rational-it.com wrote: Hi, I am trying to sote pairs in a table as follows:

[sqlalchemy] a more general elixir question

2012-02-03 Thread lars van gemerden
Is it possible to mix Elixir classes and SQLA classes in one database (with foreign keys between them)? Cheers, Lars -- 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

[sqlalchemy] Re: a more general elixir question

2012-02-03 Thread erikj
yes Elixir classes are in fact SQLA classes, only defined with a different syntax you can mix Elixir, Declarative and plain python objects mapped with SQLA On Feb 3, 12:13 pm, lars van gemerden l...@rational-it.com wrote: Is it possible to mix Elixir classes and SQLA classes in one database

[sqlalchemy] Re: a more general elixir question

2012-02-03 Thread lars van gemerden
Thanks, Can you also mix Elixir Fields and SQLA Column/relationships in the same class? Cheers, Lars On Feb 3, 12:56 pm, erikj tw55...@gmail.com wrote: yes Elixir classes are in fact SQLA classes, only defined with a different syntax you can mix Elixir, Declarative and plain python

[sqlalchemy] Re: a more general elixir question

2012-02-03 Thread erikj
no, that's not possible Elixir does some custom postprocessing on a class definition, and so does Declarative, but they are not interoperatable On Feb 3, 1:20 pm, lars van gemerden l...@rational-it.com wrote: Thanks, Can you also mix Elixir Fields and SQLA Column/relationships in the same

[sqlalchemy] Re: a more general elixir question

2012-02-03 Thread lars van gemerden
Too bad, thanks On Feb 3, 1:38 pm, erikj tw55...@gmail.com wrote: no, that's not possible Elixir does some custom postprocessing on a class definition, and so does Declarative, but they are not interoperatable On Feb 3, 1:20 pm, lars van gemerden l...@rational-it.com wrote:

[sqlalchemy] Having trouble getting a subquery to return entities

2012-02-03 Thread cbc
Hi: I'm having trouble getting a subquery to return entities. class Question(Base): __tablename__ = 'question' question_id = Column(INTEGER(unsigned=True), primary_key=True) ...etc q_answers = relationship(Answer, backref=question) class Answer(Base):

[sqlalchemy] Re: Having trouble getting a subquery to return entities

2012-02-03 Thread cbc
I should add: First element is always none _even if question has been answered by that user_ On Feb 3, 11:28 am, cbc clayton.cafi...@mondaylambson.com wrote: Hi: I'm having trouble getting a subquery to return entities. class Question(Base):         __tablename__ = 'question'        

[sqlalchemy] update table record

2012-02-03 Thread Mason
Hi, If i have a table named 'message' and it has the following columns: message_id, tar_del, src_del. I pass in del_list which is a list of message to delete. I tried the following self.session.query(Message)\ .filter(Message.message_id.in_(del_list))\

[sqlalchemy] Using a standalone SEQUENCE

2012-02-03 Thread Michael Hipp
Is there an example or other explanation of how to use a SEQUENCE that is not a primary key on a table, particularly how to create the sequence, get next value, reset seq, etc. I see the base docs here, but it's not obvious to me how exactly to use this class.

Re: [sqlalchemy] Having trouble getting a subquery to return entities

2012-02-03 Thread Michael Bayer
On Feb 3, 2012, at 11:28 AM, cbc wrote: Hi: I'm having trouble getting a subquery to return entities. class Question(Base): __tablename__ = 'question' question_id = Column(INTEGER(unsigned=True), primary_key=True) ...etc q_answers = relationship(Answer,

Re: [sqlalchemy] update table record

2012-02-03 Thread Michael Bayer
On Feb 3, 2012, at 1:04 PM, Mason wrote: Hi, If i have a table named 'message' and it has the following columns: message_id, tar_del, src_del. I pass in del_list which is a list of message to delete. I tried the following self.session.query(Message)\

Re: [sqlalchemy] Using a standalone SEQUENCE

2012-02-03 Thread Michael Bayer
On Feb 3, 2012, at 6:24 PM, Michael Hipp wrote: Is there an example or other explanation of how to use a SEQUENCE that is not a primary key on a table, particularly how to create the sequence, get next value, reset seq, etc. I see the base docs here, but it's not obvious to me how exactly