>
> if you refer to a table without a schema name, that's the schema it will
> actually use
Yes, and that's the problem.
In my dialect's base.py I define the following method:
def _get_default_schema_name(self, connection):
return 'pub'
But the code sample mentioned in my first email yields the following SELECT
*without* prefixing the column and table names with "pub":
2017-05-18 16:26:51,151 INFO sqlalchemy.engine.base.Engine SELECT foo.f1
FROM foo
I noticed that there is no handling to retrieve the dialect's
default_schema_name from within the MetaData class in sql/schema.py but
like I said I just don't know whether this is intended for a reason.
On Friday, 19 May 2017 23:19:06 UTC+10, Mike Bayer wrote:
>
>
>
> On 05/18/2017 08:42 PM, ben4ever wrote:
> > I'm writing a Progress OpenEdge dialect and when experimenting with the
> > dialect's default_schema_name I noticed that it is not automatically
> > used when creating a MetaData object without specifying a schema.
> > Here is an example where the SELECT statement does not include the
> > schema name specified in default_schema_name:
> > |
> > from urllib.parse import quote
> >
> > from sqlalchemy import create_engine, select, Table, Column, Integer,
> > MetaData
> > import sqlalchemy_progress
> >
> > connect_string = 'progress:///?odbc_connect={}'.format(quote(
> > 'DRIVER=progress;DB=bizcomm;HOST=hostname;PORT=1234;UID=admin'))
> > engine = create_engine(connect_string, echo=True)
> >
> > metadata = MetaData()
> > foo = Table('foo', metadata,
> > Column('f1', Integer),
> > Column('f2', Integer))
> >
> > print(engine.connect().execute(
> > select([foo.c.f1])
> > ).fetchall())
> > |
> >
> > Is this the intended behaviour?
>
> yes. the "default" schema means, the *database's* default schema.
> that is, if you refer to a table without a schema name, that's the
> schema it will actually use.
>
>
>
>
> >
> > --
> > SQLAlchemy -
> > The Python SQL Toolkit and Object Relational Mapper
> >
> > http://www.sqlalchemy.org/
> >
> > To post example code, please provide an MCVE: Minimal, Complete, and
> > Verifiable Example. See http://stackoverflow.com/help/mcve for a full
> > description.
> > ---
> > You received this message because you are subscribed to the Google
> > Groups "sqlalchemy" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to [email protected] <javascript:>
> > <mailto:[email protected] <javascript:>>.
> > To post to this group, send email to [email protected]
> <javascript:>
> > <mailto:[email protected] <javascript:>>.
> > Visit this group at https://groups.google.com/group/sqlalchemy.
> > For more options, visit https://groups.google.com/d/optout.
>
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.