palewire / django-postgres-copy

Quickly import and export delimited data with Django support for PostgreSQL's COPY command
https://palewi.re/docs/django-postgres-copy/
MIT License
180 stars 48 forks source link

Incompatible with Django 4.2 #160

Closed admb4r closed 9 months ago

admb4r commented 1 year ago

A recent update in Django 4.2 has changed the method signatures setup_query() and pre_sql_setup() for the SQLCompiler class to now accept the kwarg with_col_aliases=False. This is undocumented and free to change within Django versions so therefore not considered a breaking change.

SQLCopyToCompiler is a subclass of SQLCompiler and overrides the setup_query() method to add re-ordering of items. However, Django's pre_sql_setup() implementation calls setup_query() with the new with_col_aliases parameter, as shown here. This in turn calls django-postgres-copy's setup_query() resulting in SQLCopyToCompiler.setup_query() got an unexpected keyword argument 'with_col_aliases'.

I think this can be easily fixed by updating django-postgres-copy's method to accept **kwargs and passing through the parent method.

palewire commented 9 months ago

I believe this has been fixed.