I have a tree structure
Root
|
+--Area
||
|+--SubArea
|||
||+--Item
|||
||+--Item
||
|+--SubArea
| |
| +--Item
| |
| +--Item
|
+--Area
|
+--SubArea
||
|
Yes, that was what I searched for. My Solution now is to use pythons
introspection like this:
for dataClass in Master.__subclasses__():
table = sqlalchemy.orm.class_mapper(dataClass).local_table
delete_query = table.delete(). \
where(...)
session.execute(delete_query,
Hi,
I've reflected a database, and it would like to get a graphic representation
of it something like the graph_models command in django command extensions.
The best would be if the tool could create the graphics without a database
connection, simply using my metadata for example.
I've googled
On Thu, Nov 11, 2010 at 12:59 PM, Nagy Viktor viktor.n...@toolpart.hu wrote:
Hi,
I've reflected a database, and it would like to get a graphic representation
of it something like the graph_models command in django command extensions.
The best would be if the tool could create the graphics
I have a class that has two relationships to the same type of objects.
One of the relationships will store objects of type VR and the other
objects with a type CC. One object can only be in one of the lists
(relationships) at the same time:
This is the container class and its two relationships:
For cases like this I have found something like this to be useful
http://www.sqlalchemy.org/docs/orm/relationships.html#multiple-relationships-against-the-same-parent-child
using lazy loading and viewonly=True as needed
I found this to be clearer than column property because it fits cleanly
relationship() expects a class or a mapper instance, not a string. I
got this error:
ArgumentError: relationship 'available_deals' expects a class or a
mapper argument (received: type 'str')
On Nov 10, 4:46 pm, Sergey V. sergey.volob...@gmail.com wrote:
The twist is that I've spread out my
That is useful for mapping single or combined columns to an attribute.
Here, I want to map entire objects.
On Nov 10, 10:20 pm, Eric Ongerth ericonge...@gmail.com wrote:
Good point, Sergey.
Here is the relevant documentation regarding mapping attributes to
This is what I need to do, except the Merchant object is defined
before the Deal object. In the example in the documentation, I have
mapped User before I have mapped Address.
On Nov 11, 10:25 am, Mike Conley mconl...@gmail.com wrote:
For cases like this I have found something like this to be
If it's simply a matter of sequence of how code is organized:
1. Define Merchants table and mappers
2. Define Deals table and mappers
3. Add relations to Merchant
All of this can be in separate files if needed; just import right
definitions where needed.
metadata = MetaData()
merchants =
relationship() expects a class or a mapper instance, not a string. I
got this error:
ArgumentError: relationship 'available_deals' expects a class or a
mapper argument (received: type 'str')
Hmm... I'm not sure what I'm doing wrong but passing strings to
relation() definitely works for me:
Hi Hector,
If I'm not mistaken, everywhere you wrote
(MyObject.id==MyObject.containerId),
you meant to write: (Container.id==MyObject.containerId).
Instead of the backref technique, why not just create the MyObject--
Container relationship a single time in your MyObject class. That
should be
Mike, what you set forth is more of what I was actually trying to
bring into the discussion (having used that same technique myself),
rather than the link I gave above. I need to get more sleep and check
my doc references more carefully!
On Nov 11, 1:39 pm, Mike Conley mconl...@gmail.com wrote:
13 matches
Mail list logo