Skip to content

1.7.1

Compare
Choose a tag to compare
@joerivanruth joerivanruth released this 22 Sep 09:01
· 79 commits to master since this release

changes since 1.7.0

  • Bug fix: let TimeTzFromTicks and TimestampTzFromTicks use the correct time zone

  • Feature: add support for the named parameter syntax that will be introduced in
    the next major version of MonetDB AFTER Jun2023. (Not Jun2023 itself.)

Example of the named parameters:

import pymonetdb

# classic behavior: paramstyle pyformat
assert pymonetdb.paramstyle == 'pyformat'

with pymonetdb.connect('demo') as conn, conn.cursor() as cursor:
    parameters = dict(number=42, fruit="ban'ana")
    cursor.execute("SELECT %(number)s, %(fruit)s", parameters)
    assert cursor.fetchone() == (42, "ban'ana")

# enable named parameters
pymonetdb.paramstyle = 'named'

with pymonetdb.connect('demo') as conn, conn.cursor() as cursor:
    parameters = dict(number=42, fruit="ban'ana")
    cursor.execute("SELECT :number, :fruit", parameters)
    assert cursor.fetchone() == (42, "ban'ana")