Re: [sqlalchemy] mapper on a temporary class

2021-01-27 Thread Kent Bower
Excellent. As always, thanks very much for your time and answers (let alone awesome software)! On Wed, Jan 27, 2021 at 1:25 PM Mike Bayer wrote: > > > On Tue, Jan 26, 2021, at 9:01 PM, Kent Bower wrote: > > Thanks a ton for your responses. > > Do all the normal columns of an aliased class

Re: [sqlalchemy] mapper on a temporary class

2021-01-27 Thread Mike Bayer
On Tue, Jan 26, 2021, at 9:01 PM, Kent Bower wrote: > Thanks a ton for your responses. > > Do all the normal columns of an aliased class need to match the ad-hoc select > to which I map the alias? handwavy handwavy sort of yes, sort of no?there needs to be a 1-1 correspondence of

Re: [sqlalchemy] mapper on a temporary class

2021-01-26 Thread Kent Bower
Thanks a ton for your responses. Do all the normal columns of an aliased class need to match the ad-hoc select to which I map the alias? > oh if the class doesn't have a mapper, then defintiely, just make ad-hoc subclasses of it and map to those.vastly easier that way. Mapping to a subclass

Re: [sqlalchemy] mapper on a temporary class

2021-01-26 Thread Mike Bayer
On Tue, Jan 26, 2021, at 7:31 PM, Kent Bower wrote: > I should have given these details from the get-go: the use case is a > specialized select() (dynamically built) which would be extremely convenient > to map relationships against for convenience in subquery loading, etc. So, > the class

Re: [sqlalchemy] mapper on a temporary class

2021-01-26 Thread Mike Bayer
On Tue, Jan 26, 2021, at 7:31 PM, Kent Bower wrote: > I should have given these details from the get-go: the use case is a > specialized select() (dynamically built) which would be extremely convenient > to map relationships against for convenience in subquery loading, etc. So, > the class

Re: [sqlalchemy] mapper on a temporary class

2021-01-26 Thread Kent Bower
I should have given these details from the get-go: the use case is a specialized select() (dynamically built) which would be extremely convenient to map relationships against for convenience in subquery loading, etc. So, the class would not already have a mapper. Can I pass non_primary=True

Re: [sqlalchemy] mapper on a temporary class

2021-01-26 Thread Mike Bayer
On Tue, Jan 26, 2021, at 3:16 PM, Kent wrote: > Question: if I add a mapper to a class that is only needed temporarily, does > using the mapper compile it along side my "normal" mappers such that I'll > leak memory when I mean for the class to be garbage collected? > > Put another way, can I

[sqlalchemy] mapper on a temporary class

2021-01-26 Thread Kent
Question: if I add a mapper to a class that is only needed temporarily, does using the mapper compile it along side my "normal" mappers such that I'll leak memory when I mean for the class to be garbage collected? Put another way, can I add a mapper to a class that doesn't influence my "main

Re: [sqlalchemy] mapper existance checks possibly wrong

2017-10-26 Thread Антонио Антуан
Yes, it works. I'm grateful for your help :) ср, 25 окт. 2017 г. в 16:56, Mike Bayer : > On Wed, Oct 25, 2017 at 9:25 AM, Антонио Антуан > wrote: > > As I said befire, sqlalchemy version: 1.0.19 and code is here: > >

Re: [sqlalchemy] mapper existance checks possibly wrong

2017-10-25 Thread Mike Bayer
On Wed, Oct 25, 2017 at 9:25 AM, Антонио Антуан wrote: > As I said befire, sqlalchemy version: 1.0.19 and code is here: > https://gist.github.com/aCLr/113ac292c05bdb01e964d8e9884d6e5f I apologize, did not see that link. Use the execute_and_instances() implemenation from

Re: [sqlalchemy] mapper existance checks possibly wrong

2017-10-25 Thread Антонио Антуан
As I said befire, sqlalchemy version: 1.0.19 and code is here: https://gist.github.com/aCLr/113ac292c05bdb01e964d8e9884d6e5f Currently I can't use another version. In that case, I think that here is the right decision: "Looks like I have to check if "_mapper_zero()" returns real mapper. Otherwise

Re: [sqlalchemy] mapper existance checks possibly wrong

2017-10-25 Thread Mike Bayer
On Wed, Oct 25, 2017 at 6:52 AM, Антонио Антуан wrote: > Any news here? We would require a self-contained demonstration case that illustrates your error as well as complete information on what specific SQLAlchemy version you are targeting. As mentioned in a different reply,

Re: [sqlalchemy] mapper existance checks possibly wrong

2017-10-25 Thread Mike Bayer
On Wed, Oct 25, 2017 at 8:02 AM, Антонио Антуан wrote: > Looks like I have to check if _mapper_zero() returns real mapper. _mapper_zero() in the 1.1 and 1.2 series will never return a non-mapper (see https://bitbucket.org/zzzeek/sqlalchemy/issues/3608). I would strongly

Re: [sqlalchemy] mapper existance checks possibly wrong

2017-10-25 Thread Simon King
This is complete guesswork - I haven't examined this code in detail so I could be wrong. Also, I don't know what version of SQLAlchemy you are using, so this may not apply. Session.connection takes separate "mapper" and "clause" parameters:

Re: [sqlalchemy] mapper existance checks possibly wrong

2017-10-25 Thread Антонио Антуан
Looks like I have to check if _mapper_zero() returns real mapper. Otherwise I should pass None to "_connection_from_session()" as value of "mapper" argument. Right? ср, 25 окт. 2017 г. в 15:00, Антонио Антуан : > As I mentioned before, " group_getter>". > > ср, 25 окт. 2017

Re: [sqlalchemy] mapper existance checks possibly wrong

2017-10-25 Thread Антонио Антуан
As I mentioned before, "". ср, 25 окт. 2017 г. в 14:19, Simon King : > What does self._mapper_zero() return in your > RoutingQuery._execute_and_instances method? > > Simon > > On Wed, Oct 25, 2017 at 11:52 AM, Антонио Антуан > wrote: > > Any news

Re: [sqlalchemy] mapper existance checks possibly wrong

2017-10-25 Thread Simon King
What does self._mapper_zero() return in your RoutingQuery._execute_and_instances method? Simon On Wed, Oct 25, 2017 at 11:52 AM, Антонио Антуан wrote: > Any news here? > > суббота, 21 октября 2017 г., 18:42:47 UTC+3 пользователь Антонио Антуан > написал: >> >> I see that it

Re: [sqlalchemy] mapper existance checks possibly wrong

2017-10-25 Thread Антонио Антуан
Any news here? суббота, 21 октября 2017 г., 18:42:47 UTC+3 пользователь Антонио Антуан написал: > > I see that it is not happened when "bind" passed directly to > "sessionmaker" > > сб, 21 окт. 2017 г. в 18:33, Антонио Антуан : > >> >> >> пятница, 20 октября 2017 г.,

Re: [sqlalchemy] mapper existance checks possibly wrong

2017-10-21 Thread Антонио Антуан
I see that it is not happened when "bind" passed directly to "sessionmaker" сб, 21 окт. 2017 г. в 18:33, Антонио Антуан : > > > пятница, 20 октября 2017 г., 20:50:52 UTC+3 пользователь Mike Bayer > написал: > >> On Fri, Oct 20, 2017 at 11:05 AM, Simon King

Re: [sqlalchemy] mapper existance checks possibly wrong

2017-10-21 Thread Антонио Антуан
пятница, 20 октября 2017 г., 20:50:52 UTC+3 пользователь Mike Bayer написал: > > On Fri, Oct 20, 2017 at 11:05 AM, Simon King > wrote: > > The "is not None" is important when checking a variable that may > > contain a ClauseElement, precisely because ClauseElement

Re: [sqlalchemy] mapper existance checks possibly wrong

2017-10-20 Thread Mike Bayer
On Fri, Oct 20, 2017 at 11:05 AM, Simon King wrote: > The "is not None" is important when checking a variable that may > contain a ClauseElement, precisely because ClauseElement defines that > __bool__ method. > > However, in Session.get_bind(), "mapper" is not supposed to

Re: [sqlalchemy] mapper existance checks possibly wrong

2017-10-20 Thread Simon King
The "is not None" is important when checking a variable that may contain a ClauseElement, precisely because ClauseElement defines that __bool__ method. However, in Session.get_bind(), "mapper" is not supposed to contain a ClauseElement. It should either be an instance of

Re: [sqlalchemy] mapper existance checks possibly wrong

2017-10-20 Thread Антонио Антуан
Really, `mapper` contains this: . But does it changes something? I already encountered this problem in my code, when I checked sqla-objects existance without "is not None", project was broken. Is it normal to omit that condition in sqlalchemy code? I use: >>> sqlalchemy.__version__ '1.0.19'

Re: [sqlalchemy] mapper existance checks possibly wrong

2017-10-20 Thread Simon King
On Fri, Oct 20, 2017 at 2:15 PM, Антонио Антуан wrote: > Hi. > I use my own `RoutingSession` and `RoutingQuery` implementation, most of it > inspired by `sqlalchemy.ext.horizontal_shard`: > > class RoutingSession(Session): > def get_bind(self, mapper=None, clause=None,

[sqlalchemy] mapper existance checks possibly wrong

2017-10-20 Thread Антонио Антуан
Hi. I use my own `RoutingSession` and `RoutingQuery` implementation, most of it inspired by `sqlalchemy.ext.horizontal_shard`: class RoutingSession(Session): def get_bind(self, mapper=None, clause=None, shard_id=None, **kwargs): original_bind = None try:

Re: [sqlalchemy] mapper could not assemble primary key for table

2013-07-27 Thread Michael Bayer
On Jul 24, 2013, at 12:13 PM, Dennis Backhaus backha...@moxieinformatics.com wrote: I have following table: class Group(DeclarativeBase): Group definition Only the ``group_name`` column is required. __tablename__ = 'tg_group' id = Column(Integer,

[sqlalchemy] mapper could not assemble primary key for table

2013-07-26 Thread Dennis Backhaus
I have following table: class Group(DeclarativeBase): Group definition Only the ``group_name`` column is required. __tablename__ = 'tg_group' id = Column(Integer, autoincrement=True, primary_key=True) group_name = Column(Unicode(16), unique=True, nullable=False)

[sqlalchemy] mapper property creation is a bit too magically deferred

2013-06-12 Thread Andy
I just got really confused. I have code that does ...join(schema.MappedClass.relation), and it works. But I had other code that did foo = schema.MappedClass.relation, and it didn't work because 'relation' wasn't there. The fix is to call orm.configure_mappers(), which happens by magic at

Re: [sqlalchemy] mapper property creation is a bit too magically deferred

2013-06-12 Thread Michael Bayer
On Jun 12, 2013, at 8:46 PM, Andy aml...@gmail.com wrote: I just got really confused. I have code that does ...join(schema.MappedClass.relation), and it works. But I had other code that did foo = schema.MappedClass.relation, and it didn't work because 'relation' wasn't there. The fix

Re: [sqlalchemy] Mapper compilation errors in multi threaded web application using dynamic mapping to selects

2012-05-11 Thread Jochen Stenzel
. Unfortunately, there are still errors displayed. Most of the time I found 'Mapper' object has no attribute '_props'. I also tried to use the standard SQLAlchemy mapper() function instead of our wrapper mentioned in my first message (a variant of [1]). In most cases the system complained about

Re: [sqlalchemy] Mapper compilation errors in multi threaded web application using dynamic mapping to selects

2012-05-11 Thread Michael Bayer
after server startup, as often as initial processes are configured. Unfortunately, there are still errors displayed. Most of the time I found 'Mapper' object has no attribute '_props'. I also tried to use the standard SQLAlchemy mapper() function instead of our wrapper mentioned in my first

Re: [sqlalchemy] Mapper compilation errors in multi threaded web application using dynamic mapping to selects

2012-05-11 Thread Jochen Stenzel
Could it be I am not loading enough modules? Does all modules mean all modules of the application, or all modules to map successfully? yes the issue is very likely that more modules are being imported within non-main threads, and more mappers are coming in. if you get absolutely every

[sqlalchemy] Mapper compilation errors in multi threaded web application using dynamic mapping to selects

2012-05-09 Thread Jochen Stenzel
Hello, is there a problem in mapping classes to selects ([1]) /within a function/? We are running into mapper errors reading InvalidRequestError: One or more mappers failed to compile. Exception was probably suppressed within a hasattr() call. Message was: One or more mappers failed to

Re: [sqlalchemy] Mapper compilation errors in multi threaded web application using dynamic mapping to selects

2012-05-09 Thread Michael Bayer
On May 9, 2012, at 8:10 PM, Jochen Stenzel wrote: Hello, is there a problem in mapping classes to selects ([1]) /within a function/? with multiple threads, where the mappers initialization may first proceed as the product of a thread running, yes. you'd want to upgrade to 0.7 for the

Re: [sqlalchemy] Mapper compilation errors in multi threaded web application using dynamic mapping to selects

2012-05-09 Thread Claudio Freire
On Wed, May 9, 2012 at 4:11 PM, Michael Bayer mike...@zzzcomputing.com wrote: Hello, is there a problem in mapping classes to selects ([1]) /within a function/? with multiple threads, where the mappers initialization may first proceed as the product of a thread running, yes.     you'd want

[sqlalchemy] mapper error, and db object cannot be incremented

2011-06-14 Thread Liju
I'm new to SQLAlchemy. I wrote a method that retrieves a record, update the object after incrementing it by 1, and return that record object to the caller (pyramid view). Following is the test function. I get following errors : 1) when I call this method multiple times, I get an error that say

Re: [sqlalchemy] mapper error, and db object cannot be incremented

2011-06-14 Thread Michael Bayer
You're best starting with the declarative usage patterns described in the ORM tutorial at http://www.sqlalchemy.org/docs/orm/tutorial.html, starting with http://www.sqlalchemy.org/docs/orm/tutorial.html#creating-table-class-and-mapper-all-at-once-declaratively. I would declare the class +

[sqlalchemy] mapper for outerjoin: getting None objects

2010-10-31 Thread Alessandro Dentella
Hi, I have a join between 2 tables (User/Adresses, complete code below). I create a mapper as the join of the 2 classes as: m = orm.mapper(Join, User.__table__.outerjoin(Address.__table__) , properties = { 'j_id' : [Address.__table__.c.user_id,

Re: [sqlalchemy] mapper for outerjoin: getting None objects

2010-10-31 Thread Michael Bayer
On Oct 31, 2010, at 9:05 AM, Alessandro Dentella wrote: Hi, I have a join between 2 tables (User/Adresses, complete code below). I create a mapper as the join of the 2 classes as: m = orm.mapper(Join, User.__table__.outerjoin(Address.__table__) , properties = {

[sqlalchemy] Mapper setup without foreign keys.

2010-10-22 Thread prinzdezibel
I'm looking for a way to set up a mapper like in this sqlalchemy example: class User(object): pass class Address(object): pass mapper(Address, addresses_table) mapper(User, users_table, properties={ 'boston_addresses': relation(Address, primaryjoin=

[sqlalchemy] Mapper object has no attribute _props

2010-07-11 Thread Nikolaj
I was trying to add an AttributeExtension to a property from my MapperExtension but I get this error when trying to access the property: AttributeError: 'Mapper' object has no attribute '_props' Here's a test case: from sqlalchemy import create_engine, Column from sqlalchemy.ext.declarative

[sqlalchemy] mapper properties' class types: SynonymProperty

2010-05-25 Thread Kent
When introspecting a mapper, we can figure out the class type of its properties like this: For ColumnProperty: prop.columns[0].type.__class__ For RelationProperty (relationship): prop.argument For RelationProperty (backref): prop.argument.class_ How do I determine the class type a

Re: [sqlalchemy] Mapper can't map primary key

2010-04-29 Thread Lance Edgar
On 4/28/2010 11:31 PM, Mark wrote: Hi guys, I have the following Table construction: ADMIN_TABLE = Table('admin', bound_meta_data, Column('username', types.VARCHAR(100), primary_key=True), autoload=True,

Re: [sqlalchemy] Mapper can't map primary key

2010-04-29 Thread Michael Bayer
Mark wrote: sqlalchemy.exc.ArgumentError: Mapper Mapper|Admin|admin could not assemble any primary key columns for mapped table 'admin' As you can see above, I have already mapped the primary_key=True property, why is it still complaining that it can't find the primary key? With this error,

[sqlalchemy] Mapper can't map primary key

2010-04-28 Thread Mark
Hi guys, I have the following Table construction: ADMIN_TABLE = Table('admin', bound_meta_data, Column('username', types.VARCHAR(100), primary_key=True), autoload=True, schema=schema) and a mapper as such:

Re: [sqlalchemy] Mapper table properties

2010-04-25 Thread Michael Bayer
On Apr 23, 2010, at 11:29 AM, Jason Baker jba...@zeomega.com wrote: Given an entity class (or entity instance), I'd like to get the table that is mapped to it. If I get the mapper using object_mapper/ class_mapper, then I get a mapper with the following properties defined (among

[sqlalchemy] Mapper table properties

2010-04-23 Thread Jason Baker
Given an entity class (or entity instance), I'd like to get the table that is mapped to it. If I get the mapper using object_mapper/class_mapper, then I get a mapper with the following properties defined (among others): local_table, mapped_table, and tables. Can someone help me understand what

Re: [sqlalchemy] mapper for ms sql server

2010-04-09 Thread Michael Bayer
Tan Yi wrote: Hello. Recently I have been working on this environment: linux + pyodbc + sqlalchemy 5.8 + ms sql server. In the program, I try to build a mapper from a db table to my python class, then I instatiate the class, and try to use session.add() to insert record to database.

[sqlalchemy] mapper for ms sql server

2010-04-08 Thread Tan Yi
Hello. Recently I have been working on this environment: linux + pyodbc + sqlalchemy 5.8 + ms sql server. In the program, I try to build a mapper from a db table to my python class, then I instatiate the class, and try to use session.add() to insert record to database. However, I need to have

[sqlalchemy] mapper class with multiple tables

2010-02-04 Thread atomekk
Hi I'm having trouble with define mapper for class which will include data from more than 2 tables (I'm using Formalchemy for form generation). Quick brieffing on my model: # account table acc_account_table = sa.Table('acc_account', meta.metadata, sa.Column('account_id', sa.types.Integer,

[sqlalchemy] mapper for join, insert and reused instances

2009-12-09 Thread Alessandro Dentella
Hi, docs suggests (Mapping a Class against Multiple Tables) to build a mapper as this: class AddressUser(object): pass j = join(users_table, addresses_table) mapper(AddressUser, j, properties={ 'user_id': [users_table.c.user_id, addresses_table.c.user_id] })

Re: [sqlalchemy] mapper for join, insert and reused instances

2009-12-09 Thread Michael Bayer
On Dec 9, 2009, at 3:16 PM, Alessandro Dentella wrote: Hi, docs suggests (Mapping a Class against Multiple Tables) to build a mapper as this: class AddressUser(object): pass j = join(users_table, addresses_table) mapper(AddressUser, j, properties={ 'user_id':

[sqlalchemy] mapper property order

2009-12-01 Thread boothead
Hi all, There anyway to keep the ordering of properties defined on a mapper? The reason I ask is that I'm building a tabbed interface consiting of a parent form and multiple related child forms and I'd like the tabs to be in the same order that I've defined the properies on the parent mapper:

[sqlalchemy] Mapper on several columns only (multiple column_property)

2009-11-27 Thread naktinis
What is the best way to map several columns from one table to another table? Let's say I have two classes: LargeComplicatedClass and AnotherClass. LargeComplicatedClass which is has a lot of eager loads and columns with a lot of data, which is expensive to query. I also have a AnotherClass to

Re: [sqlalchemy] Mapper on several columns only (multiple column_property)

2009-11-27 Thread Michael Bayer
naktinis wrote: What is the best way to map several columns from one table to another table? Let's say I have two classes: LargeComplicatedClass and AnotherClass. LargeComplicatedClass which is has a lot of eager loads and columns with a lot of data, which is expensive to query. I also

[sqlalchemy] Mapper with declarative

2009-04-07 Thread Scripper
Hello everyone, I have a concrete question about using declarative mapper in my project. There are three tables: user, services and objects Class Services(Base): user_id = Column(user_id, Integer, ForeignKey (user_table.user_id)) .. Class Objects(Base): user_id =

[sqlalchemy] Mapper with declarative

2009-04-07 Thread Scripper
Hello everyone, I have a concrete question about using declarative mapper in my project. There are three tables: user, services and objects Class Services(Base): user_id = Column(user_id, Integer, ForeignKey (user_table.user_id)) .. Class Objects(Base): user_id =

[sqlalchemy] Mapper with declarative

2009-04-07 Thread Scripper
Hello everyone, I have a concrete question about the declarative mapper in my project. There are three tables: user, services and objects Class Services(Base): mote_id = Column(mote_id, Integer, ForeignKey (mote_table.mote_id)) Class Objects(Base): mote_id = Column(mote_id,

[sqlalchemy] Mapper with declarative

2009-04-07 Thread Scripper
Hello everyone, I have a concrete question about using declarative mapper in my project. There are three tables: user, services and objects Class Services(Base): user_id = Column(user_id, Integer, ForeignKey (user_table.user_id)) .. Class Objects(Base): user_id =

[sqlalchemy] Mapper Extensions, after_update and old data

2008-11-18 Thread Adam
I have a project where I need to monitor the changes to a record - when using after_update, is it possible to see what the data was before the update? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group.

[sqlalchemy] mapper arg in noload()

2008-06-22 Thread az
noload should be same as lazyload, eagerload. on sa0.4, noload has no mapper arg. why in 0.5 the mapper argn is gone in all of them? it is needed when query-row is of two or more entities --~--~-~--~~~---~--~~ You received this message because you are subscribed

[sqlalchemy] mapper 2 python property to 1 sql column table

2008-05-30 Thread Sed
Sorry for the subject, I wasn't able to find a good one. I'd like to have 2 differente attribute of python to be mapped in one sql column. e.g.: person_table = Table('person', metadata ,Column('id', Integer, primary_key=True) ) class Person(object): pass and I'd like to do something

[sqlalchemy] mapper extension

2008-05-20 Thread Mike Bernson
I am looking for a hook after a instance has been created, attribute populated and any initialization done. I have found populate_instance in the MapperExtension. It look like to close thing. Adding a hook to MapperExtension for after instance is created, populated, and any initialization by the

[sqlalchemy] Mapper Issue Upgrading to 0.4.5

2008-04-14 Thread Koen Bok
Hey All, I was upgrading our app from 0.4.1 to 0.4.5 and this code broke: pg_user = Table('pg_user', metadata, Column('usesysid', Integer, primary_key=True), Column('usename', Unicode(), unique=True)) pg_group = Table('pg_group', metadata, Column('grosysid', Integer,

[sqlalchemy] Mapper inheritance and joins

2007-12-29 Thread Dave Harrison
Hi all, I've got a situation where I want to use inherited mappers, with joins to other inherited mappers. However I'm getting some weird results where the following query should show no cat objects, instead I get 2 back for both queries. Can anyone spot the flaw in my code here ? The api and

[sqlalchemy] Mapper properties and a callback

2007-12-21 Thread Dave Harrison
Hi all, I have a situation where I want to declare a relation between two tables, but I want to be able to run a callback whenever I append to that relation. Here's an example class Kennel: def callback(self, o): print callback, o mapper = Mapper( Kennel, kennelTable,

[sqlalchemy] mapper relations with foreign_keys=

2007-11-29 Thread Rick Morrison
Just noticed that for mappers that use tables that do not define foreign keys, specifying only 'primaryjoin=' plus 'foreign_keys=' doesn't seem to be sufficient to define the relationship, adding 'remote_side=' fixed it. Also for such mappers, if there is a 'backref', the backref doesn't seem to

[sqlalchemy] mapper/mapperExtension initialization order / mapper.properties

2007-11-08 Thread svilen
g'day. in the Aggregator i have mapper extension, that needs info from the mapper like local-table and mapping/naming of column properties. It used to hook on instrument_class() for that, but now the mapper.properties in its new get()/iterate() form is not available yet when mapper-extensions

[sqlalchemy] mapper

2007-11-06 Thread lur ibargutxi
Hi everyone! I'm new in SQLAlchemy and this is my code: mappers['indicatorgroups'] = mapper(IndicatorGroups, tables['indicatorgroups']) mappers['groupgroups'] = mapper(GroupGroups, tables['groupgroups'], properties = { 'idindicatorgroupcontainer' :

[sqlalchemy] Mapper bug involving select with labeled foreign key target and clause default?

2007-10-27 Thread Brian Beck
Sorry for the confusing subject. If I map against a select in which one of the tables has a foreign key whose default value is set to a clause involving another table's column (also in the select), and that column is labeled, the correct values are inserted, but an exception is raised when

[sqlalchemy] Mapper based on a select generates wrong and unnecessary INSERTs

2007-07-02 Thread Andreas Jung
I have a case where SA 0.3.8 create wrong SQL code and an unneeded and unwanted INSERT statement. My code inserts a new Arbeitsmittel into the DB using: Arbeitsmittel = wrapper.getMapper('arbeitsmittel') d = {'hidx' : hidx, 'zodb_path' : zodb_path, 'versionsnr' : 0,

[sqlalchemy] Mapper with relation/custom join condition fails

2007-06-18 Thread Christoph Haas
Dear list... I'm having trouble with two assign-mappers with a custom JOIN condition. (And I admit that I'm not yet good at that in SQLAlchemy. So be gentle.) powerdns_records_table = Table( 'records', meta, Column('id', Integer, primary_key=True), Column('name', Unicode(80)),

[sqlalchemy] Mapper with custom outerjoin and sum functions

2007-03-25 Thread Koen Bok
Hello again! I need a mapper that does an outer join on another table. stock_request_join = sql.outerjoin(request_table, stock_table, and_( request_table.c.id_item==stock_table.c.id_product, request_table.c.id_location==stock_table.c.id_location,

[sqlalchemy] Mapper and Relation Question

2007-02-25 Thread robert . bagley
Hello, I have a question regarding using a mapper to add a relation to a mapped class using instance attributes (not contained in the mapped classes table def) on the mapped class control the select statement for the join. For example: my Calendar class has a relation to CalendarEvent