Hello, I'm struggling to setup SA/Pylons for a multidatabase env without much luck.
As far as I understand, I need a session per database. In Pylons, I get it "for free" via session_context binding. In other words, I have setup a session_context object for each of the database I need to work with. >>> db.get_db_session('blog') <sqlalchemy.orm.session.Session object at 0xb7337a8c> >>> db.get_db_session('cdb') <sqlalchemy.orm.session.Session object at 0xb720f7ec> Nevertheless, it is not usable: >>> model.blog_wp_posts_tbl.count().execute() Traceback (most recent call last): File "<console>", line 1, in ? File "build/bdist.linux-i686/egg/sqlalchemy/sql.py", line 474, in execute File "build/bdist.linux-i686/egg/sqlalchemy/sql.py", line 411, in execute except Exception ,e: InvalidRequestError: This Compiled object is not bound to any engine. I suppose my metadata setup is wrong. Currently it looks like this: """ blog_meta = DynamicMetaData() blog_wp_posts_tbl = Table('wp_posts', blog_meta, Column('ID', Integer, primary_key=True), Column('guid', String(255)), Column('post_author', Integer, ForeignKey('wp_users.ID'), nullable=False), Column('post_content', Unicode), ) """ Do I need to use separate DynamicMetaData() for each db conn? Do I need to connect single metadata to the correct session? SA docs shows how to connect metadata to a engine but all I have is a session. Max. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---