Support for 'quote' and 'format' parameters to copy_from() #461
Conversation
…s (without paramterizing the function yet...)
…rs now exposed by copy_from().
Hello Sean, thank you for your patch. However postgres So I'm -1 about this patch. @fogzot what do you think? |
I agree. We should probably have unified everything under copy expert some tine ago. Just adding parameters isn't going to work unless we switch to a new function that takes a configuration object. So, no, I rather not merge right now. |
My issue with While this function is very clever in providing a robust solution to the above (by sending the contents of a file through a STDIN buffer), it is still raw in the sense that the user is forced to free-form enter the COPY FROM command. I believe a more complete solution would avoid formatting a string to create a psql command, and create a higher level of abstraction: A function that accepts a file-like object, and a finite set of parameters (many with defaults). Could we write a wrapper around the C-implementation of copy_from, that takes in all of the parameters for the COPY FROM command, generates the "COPY...FROM..." command string, and passes this string along to the C function which handles the STDIN piping and execution of the command? I could take this on if the idea is approved, what are your thoughts? |
I think the abstraction level is right for psycopg, which is a driver. For instance the method
Closing this ticket as this specific patch will not be merged. |
Daniel - I didn't mean to come off as brash when saying it is a "workaround to get past permission issues", I just wanted to point out that the biggest value-add of this function is to issue the COPY FROM command without having to worry about piping STDIN. After reading your response above, I agree that the proposed function belongs at an ORM level of abstraction, and I would agree that As to SQLAlchemy supporting an abstract Thanks for the insight here, and please feel free to pass along etlalchemy to others, as I will pass along the knowledge learned here on Stack Overflow and elsewhere. (I'd love some followers on github, I think this project has legs...) |
Support added for 'quote' and 'format' parameters to the COPY FROM command.