Manlio Perillo wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi.
>
> I would like to use SQL schemas in my projects, however support in
> SQLAlchemy is quite poor.
>
> What I want to do is to create a custom MetaData object, that allows me
> to specify the default schema name to use.
>
> All tables bound to that meta data, will be created inside that schema.
> With a DDL listener, I then make sure CREATE SCHEMA and DROP SCHEMA
> statements are issued.
does this work for you ?
def Table(name, metadata, *arg, **kw):
schema = getattr(metadata, 'schema', None)
if schema is not None:
kw.setdefault('schema', schema)
return sqla.Table(name, metadata, *arg, **kw)
>
>
> By the way, another thing I would like to do is the ability to specify
> some other defaults for table creation.
> As an example, assume nullable=False as default, since I set a column
> not nullable the 99% of the time.
again I'd make def Column() that does this.
>
>
>
> Thanks Manlio
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAktnApoACgkQscQJ24LbaUSMTQCdGEyB/UqIYi9aM9es6BI7GO+4
> FzQAn3Lwa+tJSa9FPa1NeRlOQ8FvpCFV
> =a0XY
> -----END PGP SIGNATURE-----
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to [email protected].
> 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.
>
>
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
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.