On Sat, Feb 12, 2011 at 6:51 PM, Michael Bayer <[email protected]>wrote:

> Hey list -
>
> The first beta release of SQLAlchemy 0.7 is available for download.
>

Awesome!  I just gave it a test and, except for being bit by the removal of
the _CursorFairy, it appears to work very well! I didn't do any formal
check, but it _feels_ faster.

There are, however, three things I'd like to request before 0.7 is made
final. The first (largely taken from the url below) is an enhancement to
PGDDLCompiler.  Currently, I monkey-patch it:

# See: http://www.mail-archive.com/[email protected]/msg20421.html
def patch_postgresql_table_ddl():
  import sqlalchemy.dialects.postgresql.base
  class MyPGDDLCompiler(sqlalchemy.dialects.postgresql.base.PGDDLCompiler):
    def post_create_table(self, table):
      """Build table-level CREATE options like TABLESPACE."""

      table_opts = []

      inherits = table.kwargs.get('postgresql_inherits')
      if inherits is not None:
          if not isinstance(inherits, (list, tuple)):
              inherits = (inherits,)
              table_opts.append(
                  '\nINHERITS ( ' +
                  ', '.join(isinstance(i, basestring) and i
                            or self.process(i)
                            for i
                            in inherits) +
                  ' )')

      on_commit = table.kwargs.get('postgresql_on_commit')
      if on_commit:
          table_opts.append(
              '\nON COMMIT ' +
              on_commit.upper().replace('_', ' '))

      with_oids = table.kwargs.get('postgresql_with_oids')
      if with_oids is not None:
          if with_oids:
              w = 'WITH'
          else:
              w = 'WITHOUT'
          table_opts.append('\n%s OIDS' % w)

      tablespace = table.kwargs.get('postgresql_tablespace')
      if tablespace:
          table_opts.append('\nTABLESPACE ' + tablespace)

      return ''.join(table_opts)

  sqlalchemy.dialects.postgresql.base.PGDDLCompiler = MyPGDDLCompiler
  sqlalchemy.dialects.postgresql.base.PGDialect.ddl_compiler =
MyPGDDLCompiler


It's horrible, I know.

The second thing I'd like to see is also postgresql-specific. I'd like to be
able to _create_ indexes with GIN or GIST. Right now I have to hoop-jump a
bit even to determine if they exist, much less create or manage them.

Lastly, it seems as though the recipe here:

http://www.sqlalchemy.org/trac/wiki/UsageRecipes/PGValues

doesn't do argument quoting and thus appears to suffer from SQL injection
possibilities. A safer and built-in mechanism for VALUES might be pretty
useful.





-- 
Jon

-- 
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.

Reply via email to