On 6/25/15 1:34 PM, Kevin Qiu wrote:
Thanks a lot. I assume you mean polymorphic_identity refers to the
table name not the class name. It would be nice that the document can
be point this out explicitly, because the example in the document
shows both table name and class name are both small l
Thanks a lot. I assume you mean polymorphic_identity refers to the table
name not the class name. It would be nice that the document can be point
this out explicitly, because the example in the document shows both table
name and class name are both small letter, can't tell the difference .
In my hu
On 6/23/15 6:06 AM, Kevin Qiu wrote:
Thanks for response. How do you delete the joined table object of
ProjApp.
A direct delete won't do:
mydb.session.delete(projApp)
mydb.session.commit()
the following error arises:
"sqlalchemy.exc.ProgrammingError: (ProgrammingError) relation
"APPLICATION"
Thanks for response. How do you delete the joined table object of ProjApp.
A direct delete won't do:
mydb.session.delete(projApp)
mydb.session.commit()
the following error arises:
"sqlalchemy.exc.ProgrammingError: (ProgrammingError) relation "APPLICATION"
does not exist
LINE 2: FROM "APPLICATION" J
On 6/21/15 1:46 PM, Kevin Qiu wrote:
It's a test db, there's only one record being added to the table. And
I ensure that with a assertIn() test and it passes.
The original code was:
class Application(mydb.Model):
__tablename__ = 'APPLICATION'
app_id = mydb.Column(mydb.Integer, primary_key = Tr
is it the same row? same primary key? otherwise what is the SQL being
emitted, what are the results? try echo='debug'?
On 6/21/15 1:46 PM, Kevin Qiu wrote:
It's a test db, there's only one record being added to the table. And
I ensure that with a assertIn() test and it passes.
The original
It's a test db, there's only one record being added to the table. And I
ensure that with a assertIn() test and it passes.
The original code was:
class Application(mydb.Model):
__tablename__ = 'APPLICATION'
app_id = mydb.Column(mydb.Integer, primary_key = True)#app_id =
mydb.Column(mydb.String(30
did you try adding an ORDER BY to that query? calling query.first()
will return only the first result in an unordered list. It is
essentially random.
On 6/21/15 12:45 PM, Kevin Qiu wrote:
I create a unit test that add new ProjApp object to the database, but
the returned object shows it is n
I create a unit test that add new ProjApp object to the database, but the
returned object shows it is not the same object inserted, I don't follow
why it's like this because I have others tests on inserting a row to a
different table, and returned shows the same row object.
Test result:
Hi!
I got this class arrangement:
class Document(Base):
doc_number = Column(:)
doc_date = Column(:)
:
class Invoice(Document)
class CashOrder(Document)
class BankTransaction(Document)
It's joined table inheritance, Document has a table with discriminator etc.
So,
Thank you.
On Wed, Jul 24, 2013 at 5:51 PM, Michael Bayer wrote:
> its a mapper arg called inherit_condition: __mapper_args__ =
> {"inherit_condition": id==A.id}
>
> On Jul 24, 2013, at 3:42 PM, Seth P wrote:
>
> The code below produces the error message below. How do I tell SQLAlchemy
> that
its a mapper arg called inherit_condition: __mapper_args__ =
{"inherit_condition": id==A.id}
On Jul 24, 2013, at 3:42 PM, Seth P wrote:
> The code below produces the error message below. How do I tell SQLAlchemy
> that the inheritance join condition should be b.id == a.id rather than
> b.par
The code below produces the error message below. How do I tell SQLAlchemy
that the inheritance join condition should be b.id == a.id rather than
b.parent_a_id
== a.id? (I would think the primary_key=True could be a hint...) I can't
figure it out from the documentation.
class A(Base):
__tab
You are welcome,
I get a lot of help from here, taking some load of Michael's back is the least
I can do.
I got the idea from your story that you needed to understand how the mechanics
are.
I'm blessed in having very complex polymorphic self relating setups with lots
of mixins and Object funct
That is not going to work.
let me explain:
Polymorphic inheritance uses tables and discriminators and some logic somewhere
in the system. (As far as I can tell both SA and databases can do the job, i
have to look into that)
For each object there will be a table, including the "base" object.
Hi
I'm trying to mimick the example from the documentation (employee/
manager/engineer)
I've been able to add employees, and engineers, and all works as
expected
now my next step would be, creating an 'Employee' object, and some
time later, decide that he's in fact an engineer.
so my first atte
On Dec 15, 2011, at 4:06 AM, Pedro Romano wrote:
> Hi! Tried searching around for information on this topic but couldn't
> find anything, so here's the question: is it possible to use passive
> deletes with joined table inheritance? Setting the
> 'ondelete="CASCADE"' on the foreign key declaratio
Hi! Tried searching around for information on this topic but couldn't
find anything, so here's the question: is it possible to use passive
deletes with joined table inheritance? Setting the
'ondelete="CASCADE"' on the foreign key declaration of the child class
primary key is trivial, however there
> class EmployeeChecker(MapperExtension):
>def before_insert(self, mapper, connection, target):
>if type(target) != Employee:
Must be ==
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@
> However in my case I don't want to be able to persist some random Employee.
> All my employees should be engineers or managers. Ideally some exception
> should be thrown if I try to add an Employee object to my session.
Maybe something like this. But I'm not sure if it's the right way. It fai
Hi,
I read carefully the documentation at
http://www.sqlalchemy.org/docs/orm/inheritance.html and I'd like to
implement a similar joined table inheritance for my application.
The following example is provided :
*mapper(Employee, employees, polymorphic_on=employees.c.type,
polymorphic_identity='e
On May 20, 2010, at 10:20 AM, bogun.dmit...@gmail.com wrote:
> Hello.
>
> Is there any way I can use some expression for polymorphic_on mapper
> attribute?
You can get this behavior now with some effort if you create a SELECT statement
that loads the full row, including your "discriminator",
Hello.
Is there any way I can use some expression for polymorphic_on mapper
attribute?
I have tried some ways, but not got what I want.
# --- my tries
import sqlalchemy as sa
from sqlalchemy import *
from sqlalchemy import orm
from sqlalchemy.ext.declarative import declarative_base
_decl = decl
On Apr 6, 2010, at 3:56 PM, Josh Winslow wrote:
I'm attempting to use joined table polymorphism for various types of
activities. Activities all share a few common features, a location, a
reference number, time, etc. but some have some further attributes.
When I set up my map like so:
mapp
I'm attempting to use joined table polymorphism for various types of
activities. Activities all share a few common features, a location, a
reference number, time, etc. but some have some further attributes.
When I set up my map like so:
mapper(Activity, activities, polymorphic_on=activities.c.typ
Ian wrote:
> All,
>
> I have two applications: one uses Python with Sqlalchemy and the other
> uses Java with Hibernate. There is a slight mis-match between the
> joined table inheritance strategy: with Hibernate a discriminator is
> not required.
>
> The Sqlalchemy documentation says, in the Joine
All,
I have two applications: one uses Python with Sqlalchemy and the other
uses Java with Hibernate. There is a slight mis-match between the
joined table inheritance strategy: with Hibernate a discriminator is
not required.
The Sqlalchemy documentation says, in the Joined Table Inheritance
secti
Hi,
I'm struggling trying to merge two patterns which separately are no-
brainers in sqa: joined tabled inheritance and (an arbitrary number
of) graph relationships, here represented as connections and
dependencies. I've run into quite a few different errors from the
following code using version
-Base entity is Party, which has sub-types Person and Organization.
-Using joined table inheritance, with base table 'parties', and sub-
tables 'people' and 'organizations'
-Want to create association class to capture various types of
relationships between parties. Let's say this association woul
Hi,
I am playing with the mapping inheritance structures to my database.
I have a the following hierarchy:
class Tag(object):
pass
class NormalisedNameTag(Tag):
pass
class NormalisedPlaceTag(Tag):
pass
The idea is that a pre-processing step will produce a series of tags
and then
I'm working on a system that has a Base class called Object. Many
other classes inherit from this one class via joined table inheritance
and it's working great. But now there's a problem: The subclass
"Comment" does reference "Object" twice, once for the inheritance and
once as a ForeignKey to mar
Hello,
I'm busy to play with (joinded) inheritance in SQLAlchemy. I have to
design and implement a CMS-like app and my idea was to do something like
(it's the SQL script) : http://pastebin.com/m35f5227d
As you can see it's a classic inheritance situation: a base Content
(abstract) which is of a
Hi,
I've attached a test script as I'm confused with what I'm trying to do.
I have the following scenario:
- A Channel object is TV channel:
class Channel:
pass
- A Playlist object is a piece of a channel's TV program.
class Playlist:
pass
- A Playlist can be declined as different
33 matches
Mail list logo