django-postgres-copy icon indicating copy to clipboard operation
django-postgres-copy copied to clipboard

ArrayFields not supported

Open Augustinio opened this issue 4 years ago • 1 comments

Hello,

When trying to export a queryset to csv, I was faced with this error:

  File "/Users/augustinlegalle/.local/share/virtualenvs/medsmart-back-5TZiyDun/lib/python3.7/site-packages/postgres_copy/managers.py", line 220, in to_csv
    data = compiler.execute_sql(csv_path)
  File "/Users/augustinlegalle/.local/share/virtualenvs/medsmart-back-5TZiyDun/lib/python3.7/site-packages/postgres_copy/copy_to.py", line 76, in execute_sql
    c.cursor.copy_expert(copy_to_sql, stdout)
psycopg2.errors.UndefinedFunction: operator does not exist: character varying[] = text[]
LINE 1: ..."practitioners_referencepractitioner"."specialty" IN (ARRAY[...
                                                             ^
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.

This happened right after having performed a migration that changed the previously CharField specialty field into an ArrayField from django.contrib.postgres.fields.

Are ArrayFields not currently supported? What are my options?

Augustinio avatar Apr 30 '21 14:04 Augustinio

They are not currently supported, mostly because I never thought of it. Would outputting the contents of the field as a string be your goal?

palewire avatar May 01 '21 17:05 palewire