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

Add kwarg to setup query #166

Closed jayhardee9 closed 1 year ago

jayhardee9 commented 1 year ago

In recent versions of Django, the setup_query() method of the SQLCompiler accepts a keyword with_col_aliases. As it currently stands, the method override in SQLCopyToCompiler doesn't accept any keywords. So if with_col_aliases=X is passed to SQLCopyToCompiler's method, you'll get a TypeError. This PR should fix this, and I don't think it will break in older versions of Django.

Tested with Django 4.2.1. I haven't tested an older version. I believe Django 4.0 lacks the with_col_aliases keyword if someone else is up for it.

palewire commented 1 year ago

Interesting. Could you add a test for this yet?

palewire commented 1 year ago

Thanks for this. I think it will be addressed by #167