datagouv / hydra

Async metadata crawler for data.gouv.fr
3 stars 0 forks source link

hydra: issue with `analyse-csv` CLI #179

Closed bolinocroustibat closed 1 month ago

bolinocroustibat commented 1 month ago
$ udata-hydra analyse-csv --check-id=13853277
Traceback (most recent call last):
  File "asyncpg/protocol/prepared_stmt.pyx", line 175, in asyncpg.protocol.protocol.PreparedStatementState._encode_bind_msg
  File "asyncpg/protocol/codecs/base.pyx", line 227, in asyncpg.protocol.protocol.Codec.encode
  File "asyncpg/protocol/codecs/base.pyx", line 129, in asyncpg.protocol.protocol.Codec.encode_scalar
  File "asyncpg/pgproto/./codecs/int.pyx", line 54, in asyncpg.pgproto.pgproto.int4_encode
TypeError: an integer is required (got type str)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/srv/hydra-hydra/bin/udata-hydra", line 8, in <module>
    sys.exit(run())
  File "/srv/hydra-hydra/lib/python3.9/site-packages/minicli/__init__.py", line 161, in run
    command.func(command, **shared)
  File "/srv/hydra-hydra/lib/python3.9/site-packages/minicli/__init__.py", line 45, in invoke
    return self(*args, **kwargs)
  File "/srv/hydra-hydra/lib/python3.9/site-packages/minicli/__init__.py", line 29, in __call__
    asyncio.get_event_loop().run_until_complete(res)
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/srv/hydra-hydra/lib/python3.9/site-packages/udata_hydra/cli.py", line 161, in analyse_csv_cli
    await analyse_csv(check_id=check_id, url=url, debug_insert=debug_insert)
  File "/srv/hydra-hydra/lib/python3.9/site-packages/udata_hydra/analysis/csv.py", line 115, in analyse_csv
    check: dict = await Check.get(check_id) if check_id is not None else {}
  File "/srv/hydra-hydra/lib/python3.9/site-packages/udata_hydra/db/check.py", line 23, in get
    return await connection.fetchrow(q, check_id)
  File "/srv/hydra-hydra/lib/python3.9/site-packages/asyncpg/connection.py", line 749, in fetchrow
    data = await self._execute(
  File "/srv/hydra-hydra/lib/python3.9/site-packages/sentry_sdk/integrations/asyncpg.py", line 130, in _inner
    res = await f(*args, **kwargs)
  File "/srv/hydra-hydra/lib/python3.9/site-packages/asyncpg/connection.py", line 1794, in _execute
    result, _ = await self.__execute(
  File "/srv/hydra-hydra/lib/python3.9/site-packages/asyncpg/connection.py", line 1892, in __execute
    result, stmt = await self._do_execute(
  File "/srv/hydra-hydra/lib/python3.9/site-packages/asyncpg/connection.py", line 1945, in _do_execute
    result = await executor(stmt, None)
  File "asyncpg/protocol/protocol.pyx", line 186, in bind_execute
  File "asyncpg/protocol/prepared_stmt.pyx", line 204, in asyncpg.protocol.protocol.PreparedStatementState._encode_bind_msg
asyncpg.exceptions.DataError: invalid input for query argument $1: '13853277' (an integer is required (got type str))