Skip to content

Adding to a table with primary key defined with SERIAL #24

@grofte

Description

@grofte

When I tried inserting I got an error like so:

Traceback (most recent call last):
  File "results_sql_fasttext.py", line 284, in <module>
    d6tstack.utils.pd_to_psql(aux_results, URI, 'aux_results', if_exists='append')
  File "/usr/local/lib/python3.6/dist-packages/d6tcollect/__init__.py", line 58, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/d6tstack/utils.py", line 107, in pd_to_psql
    cursor.copy_from(fbuf, table_name, sep=sep, null='')
psycopg2.errors.InvalidTextRepresentation: invalid input syntax for type integer: "ANSVAR"
CONTEXT:  COPY aux_results, line 1, column aux_id: "ANSVAR"

aux_id is the id created by the database - nothing should be inserted into it since it is auto-generated. "ANSVAR" is a string that should go into the fourth column, not the first. So it seems there are multiple issues at play.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions