diff -up sqlamp-0.5.2/CHANGES.sqlite36x sqlamp-0.5.2/CHANGES --- sqlamp-0.5.2/CHANGES.sqlite36x 2010-09-19 16:19:09.000000000 +0200 +++ sqlamp-0.5.2/CHANGES 2011-12-02 13:19:54.989707752 +0100 @@ -1,3 +1,8 @@ +0.5.3: *not released yet* +------------------------- +- Workaround for bug in sqlite 3.6.x (problems with binding two integer + attributes). Initial patch by Josip Delic. + 0.5.2: released 2010-09-19 -------------------------- - SQLAlchemy of versions 0.6.x is now supported as well as 0.5.x. diff -up sqlamp-0.5.2/sqlamp/__init__.py.sqlite36x sqlamp-0.5.2/sqlamp/__init__.py --- sqlamp-0.5.2/sqlamp/__init__.py.sqlite36x 2010-09-19 16:21:10.000000000 +0200 +++ sqlamp-0.5.2/sqlamp/__init__.py 2011-12-02 13:18:07.718587932 +0100 @@ -237,14 +237,14 @@ class _InsertionsParamsSelector(object): # `tree_id` is next unused integer value, # `depth` for root nodes is equal to zero, # `path` should be empty string. - query = self.session.execute(sqlalchemy.select([ - (sqlalchemy.func.coalesce( - sqlalchemy.func.max(opts.tree_id_field), 0) - + 1).label('tree_id') - ])).fetchone() - self._query_result = dict( - path='', depth=0, tree_id=query['tree_id'] - ) + [tree_id] = self.session.execute( + sqlalchemy.func.max(opts.tree_id_field) + ).fetchone() + if tree_id is None: + tree_id = 1 + else: + tree_id += 1 + self._query_result = dict(path='', depth=0, tree_id=tree_id) else: # a new instance has at least one ancestor. # `tree_id` can be used from parent's value,