Skip to content

Commit

Permalink
Merge branch 'release/0.31.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
xrotwang committed Jan 16, 2015
2 parents a55190a + 88baffe commit 993e9bf
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Expand Up @@ -2,6 +2,12 @@
Changes
-------

0.31.2
~~~~~~

- Now that usage patterns have formed, a new (final) API of the pg_collkey support has been settled on.


0.31.1
~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion clld/__init__.py
Expand Up @@ -5,7 +5,7 @@
from clld import interfaces


__version__ = "0.31.1"
__version__ = "0.31.2"


class Resource(namedtuple('Resource', 'name model interface with_index with_rdfdump')):
Expand Down
21 changes: 17 additions & 4 deletions clld/db/util.py
Expand Up @@ -3,25 +3,38 @@
import time
import re

from sqlalchemy import Integer
from sqlalchemy import Integer, event
from sqlalchemy.orm import joinedload
from sqlalchemy.schema import DDL
from sqlalchemy.sql.expression import cast, func
import transaction

from clld.db.meta import DBSession
from clld.db.meta import DBSession, Base
from clld.db.models import common


def as_int(col):
return cast(col, Integer)


COLLKEY_SQL = """
def with_collkey_ddl(): # pragma: no cover
"""Register creation of collkey function.
Can be called at module level in db initialization scripts to create the collkey
function. Once a session is bound to an engine collkey can be used to create indexes
or in order_by clauses, e.g.::
Index('ducet', collkey(common.Value.name)).create(DBSession.bind)
"""
event.listen(
Base.metadata,
'before_create',
DDL("""
CREATE OR REPLACE FUNCTION collkey (text, text, bool, int4, bool) RETURNS bytea
LANGUAGE 'c' IMMUTABLE STRICT AS
'$libdir/collkey_icu.so',
'pgsqlext_collkey';
"""
""").execute_if(dialect='postgresql'))


def collkey(col, locale='root', special_at_4=True, level=4, numeric_sorting=False):
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Expand Up @@ -51,10 +51,10 @@
# built documents.
#
# The full version, including alpha/beta/rc tags.
release = '0.31.1'
release = '0.31.2'

# The short X.Y version.
version = '0.31.1'
version = '0.31.2'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -80,7 +80,7 @@
]

setup(name='clld',
version='0.31.1',
version='0.31.2',
description=(
'Python library supporting the development of cross-linguistic databases'),
long_description=README + '\n\n' + CHANGES,
Expand Down

0 comments on commit 993e9bf

Please sign in to comment.