[sqlalchemy] Getting error while using MapperExtension

2008-04-08 Thread Sanjay

Hi,

In a project, I am using MapperExtension this way:

class TaskExtension(MapperExtension):
def populate_instance(self, mapper, selectcontext, row, instance,
**flags):
 mapper.populate_instance(selectcontext, row, instance,
**flags)
 instance.on_load() # does some custom initialization

It gives me the following exception:

TypeError: ('Task' object is unsubscriptable...

Needing help.

thanks
Sanjay
--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Querying for the existence of an object in the database

2008-04-08 Thread pyplexed

Thanks Michael. The classmethod code worked a treat.

I see merge() has changed in the new release of SA. Does this affect
the solution?
--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] PostgreSQL Schema

2008-04-08 Thread Madhu Alagu

Hi,


How to set schema in sqlalchemy ?.(Set search_path To neithal,public)

#neithal.login_f
#select([func.login_f(username,password,lang)])


Thanks

Madhu Alagu
--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: PostgreSQL Schema

2008-04-08 Thread Michael Bayer


On Apr 8, 2008, at 10:33 AM, Madhu Alagu wrote:


 Hi,


 How to set schema in sqlalchemy ?.(Set search_path To neithal,public)

 #neithal.login_f
 #select([func.login_f(username,password,lang)])



try func.neithal.login_f(xxx)



--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Merging Objects Issue

2008-04-08 Thread Alex Ezell

Pardon my probably misuse of terminology in my question below. I've
just begun to use SA and am still learning what to call everything :)

Overview:
I want to create an object in one HTTP request and then retrieve it in
a second HTTP request, update it, and finally insert it all to the DB.
Yes, this is in a Django app, but the model History() below is an
Elixir entity.

OK, so I am creating an object, modifying it, and saving it to the
session like this:

# History is an Elixir object subclassed from Entity
history = History()
history.account_id = account_id
session.save(history)

# pickle the object
history_pickle = pickle.dumps(history)

# pickle is then stored in the HTTP session
request.session['history_object'] = history_pickle

Now, in a subsequent HTTP request, I take that object out of the
session and depickle it.

history = pickle.loads(request.session['history_object'])

# merge the existing object back into the session
session.merge(history)

# make further modifications to object
history.user_id = user_id
...
session.save(history)
session.flush()

When I do this, I receive this error that seems to occur on the merge():
Class 'History' entity name 'None' has no mapper associated with it.

I've tried supplying an entity name in the merge() call, but I'm
unsure what that name should be. I also toyed with the dont_load=True
attribute since (if I understand save() correctly) this history object
will not exist as a row in the DB.

Can someone point in the right direction here with what I am trying to do?

Thanks!

/alex

--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Merging Objects Issue

2008-04-08 Thread Michael Bayer



On Apr 8, 11:05 am, Alex Ezell [EMAIL PROTECTED] wrote:

 When I do this, I receive this error that seems to occur on the merge():
 Class 'History' entity name 'None' has no mapper associated with it.

 I've tried supplying an entity name in the merge() call, but I'm
 unsure what that name should be. I also toyed with the dont_load=True
 attribute since (if I understand save() correctly) this history object
 will not exist as a row in the DB.

 Can someone point in the right direction here with what I am trying to do?

this situation occurs because there is no mapper configured for the
History class when it is deserialized into the new HTTP process.
the entity_name part of the error is not significant here and I
should probably not have it say anything about entity name in the
usual case.

as to why theres no mapper, for a straight SA application it would be
because the module which configures the mappings hasn't yet been
imported in that process; for elixir, you might need to do their
setup_all() call to ensure their stuff is set up.
--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Merging Objects Issue

2008-04-08 Thread Alex Ezell

On Apr 8, 10:12 am, Michael Bayer [EMAIL PROTECTED] wrote:
 On Apr 8, 11:05 am, Alex Ezell [EMAIL PROTECTED] wrote:

  When I do this, I receive this error that seems to occur on the merge():
  Class 'History' entity name 'None' has no mapper associated with it.

  I've tried supplying an entity name in the merge() call, but I'm
  unsure what that name should be. I also toyed with the dont_load=True
  attribute since (if I understand save() correctly) this history object
  will not exist as a row in the DB.

  Can someone point in the right direction here with what I am trying to do?

 this situation occurs because there is no mapper configured for the
 History class when it is deserialized into the new HTTP process.
 the entity_name part of the error is not significant here and I
 should probably not have it say anything about entity name in the
 usual case.

Thanks for the clarification.

 as to why theres no mapper, for a straight SA application it would be
 because the module which configures the mappings hasn't yet been
 imported in that process; for elixir, you might need to do their
 setup_all() call to ensure their stuff is set up.

The setup_all() call seemed to solve the issue with the mapper. Now,
I'm getting an error like:

'ColumnProperty' object has no attribute 'key'

when I attempt the session.merge(). The column it seems to happen with
is defined as:

id = Field(Integer,
PassiveDefault(text(nextval(('history_seq'::text)::regclass))),
colname='history_id', primary_key=True)

This could be because of the interesting PassiveDefault stuff or just
because this is the first field defined in the History() class.

Thanks again for your help. This is SA 0.4.5 in case it matters. ;)

/alex


--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: has() and multiple tables

2008-04-08 Thread Jonathan Ellis

On 4/7/08, Jonathan Ellis [EMAIL PROTECTED] wrote:
 I'm confused -- this sample does correlate actions with tasks, but not
  tasks with connections.  Intuitively it seems that X.has(Y) should
  always add a clause to the the exists for y.y_id = x.y_id.  No?

Mike cleared this up for me in IRC:

X.prop.has(criterion) just means,

exists(select 1 from child where child.id=parent.x_id AND criterion)

so the more elegant way to do this is

session.query(Action).filter(Action.task.has(Task.connection.has(Connection.caller==caller1)))

-Jonathan

--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Sqlalchemy Stored Procedures

2008-04-08 Thread Rick Morrison
Would you please post the traceback that you're getting with this?

Note that you don't need the session.begin() and session.flush() with a
transactional sessions, the .begin() is implicit and the .flush() will be
issued by the .commit()

On Tue, Apr 8, 2008 at 1:51 AM, Madhu Alagu [EMAIL PROTECTED] wrote:


 Hi,


 I would like to use advantage of the Sqlalchemy   Stored Procedures.


 engine = create_engine('postgres://postgres:[EMAIL PROTECTED]:5432/
 neithal', echo=True)
 session =
 scoped_session(sessionmaker(bind=eng,transaction=True,autoflush=False))
 trans=session.begin()
 sql = select([func.add_user_f(108,'kk','kk')])
 result = session.execute(sql)
 result.close()
 session.flush()
 session.commit()





 Thanks

 Madhu Alagu
 


--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: patch for mssql odbc

2008-04-08 Thread Florent Aide

On Tue, Apr 8, 2008 at 7:02 PM, Rick Morrison [EMAIL PROTECTED] wrote:
 I'll reply here rather than on the ticket as I'm unable to stay logged into
 Trac from here (dual TCP/IP address problem).


I see no objection as long as we can document it somewhere to say it
will impact the AutoTranslate argument on the odbc connection...

Florent.

--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: patch for mssql odbc

2008-04-08 Thread Rick Morrison
I'll reply here rather than on the ticket as I'm unable to stay logged into
Trac from here (dual TCP/IP address problem).

 I have just posted a patch for the MSSQL_odbc dialect. The ticket
 number is #1005.

The patch is certainly simple enough, but any objection if we call the key
odbc_autotranslate instead of simply autotranslate?

Thanks for the patch,
Rick

--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: has() and multiple tables

2008-04-08 Thread Tim Lesher
On Tue, Apr 8, 2008 at 1:00 PM, Jonathan Ellis [EMAIL PROTECTED]
wrote:


 session.query(Action).filter(Action.task.has(Task.connection.has(Connection.caller==caller1)))


Yep--that's what I'm doing now.  It has the effect of creating another
nested subselect, but I'm not too concerned about that as both are
relatively cheap EXISTS queries.


-- 
Tim Lesher [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Merging Objects Issue

2008-04-08 Thread Michael Bayer


On Apr 8, 2008, at 12:50 PM, Alex Ezell wrote:

 The setup_all() call seemed to solve the issue with the mapper. Now,
 I'm getting an error like:

 'ColumnProperty' object has no attribute 'key'

 when I attempt the session.merge(). The column it seems to happen with
 is defined as:

 id = Field(Integer,
 PassiveDefault(text(nextval(('history_seq'::text)::regclass))),
 colname='history_id', primary_key=True)


a stack trace will help to debug this issue.



--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Getting error while using MapperExtension

2008-04-08 Thread Michael Bayer


On Apr 8, 2008, at 6:56 AM, Sanjay wrote:


 Hi,

 In a project, I am using MapperExtension this way:

 class TaskExtension(MapperExtension):
  def populate_instance(self, mapper, selectcontext, row, instance,
 **flags):
   mapper.populate_instance(selectcontext, row, instance,
 **flags)
   instance.on_load() # does some custom initialization

 It gives me the following exception:

 TypeError: ('Task' object is unsubscriptable...


its a simple argument-passing error.  would need to see a full stack  
trace to see what argument is being mis-interpreted and by whom.

--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Getting error while using MapperExtension

2008-04-08 Thread Rick Morrison
For your call to mapper.populate_instance, you have the arguments for 'row'
and 'instance' reversed.

On Tue, Apr 8, 2008 at 6:56 AM, Sanjay [EMAIL PROTECTED] wrote:


 Hi,

 In a project, I am using MapperExtension this way:

 class TaskExtension(MapperExtension):
def populate_instance(self, mapper, selectcontext, row, instance,
 **flags):
 mapper.populate_instance(selectcontext, row, instance,
 **flags)
 instance.on_load() # does some custom initialization

 It gives me the following exception:

 TypeError: ('Task' object is unsubscriptable...

 Needing help.

 thanks
 Sanjay
 


--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Merging Objects Issue

2008-04-08 Thread Alex Ezell

On Apr 8, 1:20 pm, Michael Bayer [EMAIL PROTECTED] wrote:
 On Apr 8, 2008, at 12:50 PM, Alex Ezell wrote:

  The setup_all() call seemed to solve the issue with the mapper. Now,
  I'm getting an error like:

  'ColumnProperty' object has no attribute 'key'

  when I attempt the session.merge(). The column it seems to happen with
  is defined as:

  id = Field(Integer,
  PassiveDefault(text(nextval(('history_seq'::text)::regclass))),
  colname='history_id', primary_key=True)

 a stack trace will help to debug this issue.

Good point ;)

I've pasted it here: http://dpaste.com/43794/

Thanks for taking a look.

/alex
--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: patch for mssql odbc

2008-04-08 Thread Rick Morrison
r4479 has the new 'odbc_autotranslate' flag

Currently documented only in the CHANGES file, more docs will follow later.

--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Merging Objects Issue

2008-04-08 Thread Michael Bayer


On Apr 8, 2008, at 3:02 PM, Alex Ezell wrote:


 On Apr 8, 1:20 pm, Michael Bayer [EMAIL PROTECTED] wrote:
 On Apr 8, 2008, at 12:50 PM, Alex Ezell wrote:

 The setup_all() call seemed to solve the issue with the mapper. Now,
 I'm getting an error like:

 'ColumnProperty' object has no attribute 'key'

 when I attempt the session.merge(). The column it seems to happen  
 with
 is defined as:

 id = Field(Integer,
 PassiveDefault(text(nextval(('history_seq'::text)::regclass))),
 colname='history_id', primary_key=True)

 a stack trace will help to debug this issue.

 Good point ;)

 I've pasted it here: http://dpaste.com/43794/

 Thanks for taking a look.


thats really weird.  mappers still aren't compiled, or at least that  
property isn't.  try saying compile_mappers().   i think we need to  
see how you're doing all this, though.  your elixir/ORM everything  
should be fully imported and setup before you do any pickle activity.



--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Merging Objects Issue

2008-04-08 Thread Alex Ezell

  Good point ;)

  I've pasted it here:http://dpaste.com/43794/

  Thanks for taking a look.

 thats really weird.  mappers still aren't compiled, or at least that  
 property isn't.  try saying compile_mappers().   i think we need to  
 see how you're doing all this, though.  your elixir/ORM everything  
 should be fully imported and setup before you do any pickle activity.

I'll try that with compile_mappers() and try to abstract out what
seems to be issue so I can do a paste for all to see without all the
other gibberish that I'm doing :)

I did have to delete the paste above. There was a URL in there that
didn't really need to be all over Google (though it's probably too
late).

Thanks for your patience.

/alex
--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: ORM as a view

2008-04-08 Thread Yannick Gingras

jason kirtland [EMAIL PROTECTED] writes:

 A couple approaches come to mind:
 - map Obj to a select() with the restrictions baked in

I adapted the example the manual:

  http://www.sqlalchemy.org/docs/04/mappers.html#advdatamapping_mapper_selects

It works great!  

The only thing that wasn't explicit from the example was that the
properties of the mapped objected has to use the columns of the select
object instead of the tables ones:

 -_next_join = (po_details_table.c.status_code_next
 +_pod_select = select([po_details_table],
 + and_(po_details_table.c.line_type == J ,
 +  po_details_table.c.line_no  0)
 + ).alias(pod_select)
 +
 +_next_join = (_pod_select.c.status_code_next
== order_rules_table.c.status_code)
 -_last_join = (po_details_table.c.status_code_last
 +_last_join = (_pod_select.c.status_code_last
== order_rules_table.c.status_code)
 -mapper(PODetail, po_details_table,
 +
 +mapper(PODetail, _pod_select,
 properties=dict(status_rule_next=relation(OrderRule,
   primaryjoin=_next_join),
 status_rule_last=relation(OrderRule,

It would be nice if the example could illustrate this subtlety.
Otherwise, I love it.

Thanks!

-- 
Yannick Gingras

--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] lazy loaders and None / NULL

2008-04-08 Thread Rick Morrison
Is there a reason that lazy loaders for a 1-many relationship with an
underlying FK column value of NULL still try to load instances with a query
when an access is made to the mapped attribute? You know it's going to be an
empty collection, right?

--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: has() and multiple tables

2008-04-08 Thread Jonathan Ellis

On 4/8/08, Tim Lesher [EMAIL PROTECTED] wrote:
 Yep--that's what I'm doing now.  It has the effect of creating another
 nested subselect, but I'm not too concerned about that as both are
 relatively cheap EXISTS queries.

I wouldn't be surprised if PG's optimizer can inline it anyway.

--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: lazy loaders and None / NULL

2008-04-08 Thread Michael Bayer


On Apr 8, 2008, at 6:56 PM, Rick Morrison wrote:

 Is there a reason that lazy loaders for a 1-many relationship with  
 an underlying FK column value of NULL still try to load instances  
 with a query when an access is made to the mapped attribute? You  
 know it's going to be an empty collection, right?


the lazy loader is not supposed to fire off unless the instance has an  
_instance_key on it (and therefore has a primary key).So theres a  
little bit of an assumption that the collection is keyed off the  
primary key of the parent instance (with 1-many the FK is on the  
remote table so I assume thats what you meant).   I guess thats not  
the case with your test case, so lazy_clause() could be enhanced to  
return None if no binds get a value (theres some other mechanics  
regarding deferred loading of attributes in that function which  
LoadLazyAttribute could send in a flag to disable).

--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Merging Objects Issue

2008-04-08 Thread Michael Bayer


any chance an actual Mapper is getting pickled and unpickled in that  
process ?  the stack trace indicates a mapper in a state that it  
should never be in.



--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Sharing metadata between modules...

2008-04-08 Thread Douglas Mayle

Hi everybody, I was hoping to ask for a bit of help...

I've been trying various ways to share metadata between modules so  
that one module I import can use and improve upon the models I've  
created in a different module, and I can't seem to get it quite right...

Files within the same module could always just import metadata from a  
single-shared location, but since they're different modules, I can't  
seem to find another solution than metaprogramming...

If I'm outside of both of the modules, I can import one, and then  
monkeypatch it using the other, but I wasn't too happy about that.

The other solution I imagined was having a function in one module  
return a bunch of class objects representing the models, but I can't  
figure out how to import those into the current module..

Has anyone else already come across this?

Thanks,
Douglas Mayle

--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: PostgreSQL Schema

2008-04-08 Thread Madhu Alagu


db.engine = engine
sm = sessionmaker(autoflush=True,
transactional=True,bind=db.engine)
db.Session =scoped_session(sm)
trans=db.Session.begin()
db.Session.execute('set search_path to neithal,public')
trans.commit()
db.Session.commit()



_f = select([func.login_f(xxx)])
rs = db.Session.execute(_f)



Now,It's working fine.


Thanks

Madhu Alagu




On Apr 8, 5:41 pm, Michael Bayer [EMAIL PROTECTED] wrote:
 On Apr 8, 2008, at 10:33 AM, Madhu Alagu wrote:



  Hi,

  How to set schema in sqlalchemy ?.(Set search_path To neithal,public)

  #neithal.login_f
  #select([func.login_f(username,password,lang)])

 try func.neithal.login_f(xxx)
--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Getting error while using MapperExtension

2008-04-08 Thread Sanjay

 For your call to mapper.populate_instance, you have the arguments for 'row'
 and 'instance' reversed.

Yes! reversing it works perfectly. I had guessed the argument sequence
from the MapperExtension.populate_instance, which happens to be
reverse.

thanks a lot!
Sanjay

--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---