Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Expose SQLAlchemy's queries and their metadata to a webservice

Project description

This package contains a few utilities to make it easier applying some filtering to a stock query and obtaining the resultset in various formats.

Since version 4 only Python 3 is supported: if you are still working with Python 2 (really⁈) you may want to use version 3.6 instead.

See latest documentation at

Tests suite

The tests suite is based on tox and pytest: to run it simply execute

$ make test

The PostgreSQL unit requires an existing database called mp_sa_proxy_test with the hstore extension, and that the current user can access it without password:

$ createdb mp_sa_proxy_test
$ psql -c "create extension hstore;" mp_sa_proxy_test


5.12 (2018-11-06)

  • Fix deprecated import of abstract classed directly from the collections module

5.11 (2018-09-09)

  • Fix deprecation warning related to collections abstract classes import

5.10 (2018-07-01)

  • Fix failure extracting metadata of a column associated to a Sequence

5.9 (2018-07-01)

  • Rename the async module to asyncio for Python 3.7 compatibility

5.8 (2018-04-13)

  • Align the async layer with latest changes related to CompoundSelect support, now almost complete

5.7 (2018-04-13)

  • Extend last fix to the Pyramid expose() decorator (yes, I know, I should really invest some time in writing some tests for that…)

5.6 (2018-04-12)

  • Handle CompoundSelect such as SELECT 'foo' UNION SELECT 'bar'

5.5 (2018-04-09)

  • Fix… last fix :-|

5.4 (2018-04-09)

  • Fix regression that broke using a generator as an expose() function

5.3 (2018-03-15)

  • The Pyramid expose() decorator now forwards unrecognized keyword arguments to the proxy call

5.2 (2018-03-12)

  • Handle extraction of metadata from a BinaryExpression such as SELECT jsonfield['attr']

5.1 (2018-03-08)

  • When a column has a default value, and it is directly computable (i.e. it is not a server side default), then extract it into its metadata

5.0 (2017-07-22)


This release breaks backward compatibility in several ways!

  • More versatile way to add/override basic metadata information (see register_sa_type_metadata())

  • More versatile way to use different JSON library or encode/decode settings (see register_json_decoder_encoder()): although the default implementation is still based on nssjson, it is not required by default anymore at install time

  • Basic metadata changed:

    • the width slot for all fields is gone, it’s more reasonably computed by the actual UI framework in use: it was rather arbitrary anyway, and set to length * 10 for String columns

    • the length slot is present only for String columns

    • the type slot now basically follows the SQLAlchemy nomenclature, in particular:


      is now integer instead of int


      is now integer, instead of int with an arbitrarily different width than the one used for Integer


      is now numeric instead of float


      is now datetime instead of date with timestamp set to True


      is now time instead of date with time set to True


      is now interval instead of string with timedelta set to True


      is now text instead of string with an arbitrary width of 50


      is now text`


      is now string

    • the format slot for DateTime, Date and Time fields is gone, as it was ExtJS specific

4.8 (2017-06-17)

  • Use a tuple instead of a list for the foreign_keys slot in metadata, and for the primary_key too when it is composed by more than one column

4.7 (2017-05-18)

  • Properly recognize SA Interval() columns

4.6 (2017-05-08)

  • Handle big integers in metadata information

4.5 (2017-04-10)

  • Fix a crash when applying a filter on a non-existing column in a statement selecting from a function

4.4 (2017-04-01)

  • Rename filter operator CONTAINED to CONTAINS, and reimplement it to cover different data types, in particular PostgreSQL’s ranges

4.3 (2017-03-22)

  • Minor tweak, no externally visible changes

4.2 (2017-03-10)

  • Reduce clutter, generating a simpler representation of Operator and Direction enums

4.1 (2017-02-13)

  • Fix an oversight in Filter tuple slots positions, to simplify Filter.make() implementation

4.0 (2017-02-13)

  • From now on, a Python3-only package
  • Backward incompatible sorters and filters refactor, to make interaction easier for code using the library
  • Drop obsolete Pylons extension

3.6 (2017-01-11)

  • New Sphinx documentation
  • Field’s metadata now carries also information about foreign keys
  • Handle literal columns in core queries

3.5 (2016-12-29)

  • Fix incompatibility issue with SQLAlchemy 1.1.x when using ORM

3.4 (2016-03-12)

  • Better recognition of boolean argument values, coming from say an HTTP channel as string literals
  • Use tox to run the tests

3.3 (2016-02-23)

  • Handle the case when the column type cannot be determined

3.2 (2016-02-19)

  • Fix corner case with queries ordered by a subselect

3.1 (2016-02-07)

  • Fix metadata extraction of labelled columns on joined tables
  • Adjust size of time fields and align them to the right

3.0 (2016-02-03)

  • Internal, backward incompatible code reorganization, splitting the main module into smaller pieces
  • Handle corner cases with joined queries involving aliased tables

Previous changes are here.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for metapensiero.sqlalchemy.proxy, version 5.12
Filename, size File type Python version Upload date Hashes
Filename, size metapensiero.sqlalchemy.proxy-5.12.tar.gz (47.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page