psqlpy icon indicating copy to clipboard operation
psqlpy copied to clipboard

psqlpy.exceptions.RustToPyValueMappingError: array contains too many dimensions

Open nicolaspi opened this issue 1 year ago • 1 comments
trafficstars

psqlpy-0.7.6 The following code raises: psqlpy.exceptions.RustToPyValueMappingError: Can't convert value from driver to python type: Cannot convert PostgreSQL type _int4 into Python type, err: array contains too many dimensions (the query executes properly in PSQL)

import asyncio
from psqlpy import ConnectionPool


def main():
    db_pool = ConnectionPool()
    result = asyncio.run(db_pool.execute(
        "SELECT array_agg(arr) FROM (SELECT array(SELECT generate_series(0, 10, 1)) as arr FROM (SELECT generate_series(0, 10, 1) as value));",
    ))
    result.result()
    db_pool.close()

main()

nicolaspi avatar Aug 18 '24 16:08 nicolaspi

Hello! Thank you for your issue. I've found out that there is really a bug, and I'll fix it as soon as possible.

Thank you!

chandr-andr avatar Aug 19 '24 12:08 chandr-andr

@nicolaspi Hello! I've made a new release https://github.com/psqlpy-python/psqlpy/releases/tag/0.7.7 with support for multi-dimensional arrays. Please check it out)

chandr-andr avatar Aug 27 '24 14:08 chandr-andr