Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support the COPY command #1

Open
begriffs opened this issue Nov 11, 2014 · 10 comments
Open

Support the COPY command #1

begriffs opened this issue Nov 11, 2014 · 10 comments

Comments

@begriffs
Copy link

My app needs to bulk-load data and postgres' copy mode is the fastest way to do it. Postgresql-simple supports it with this. Would be great if this library did too.

Thanks for making hasql! I'll actually be switching over to it anyway, and the copy command would be the icing on the cake.

@nikita-volkov
Copy link
Owner

Thank you. Nice to hear.

It's actually the first time I had to read the docs on the COPY command, so I'll need some clarifications.
I'm not sure what's stopping you from using it directly, e.g.:

H.unit $ [H.q| COPY table FROM filename |]

@begriffs
Copy link
Author

Well in my case the data will be coming in as a post to my web server and the database lives on another computer which does not have access to the web server filesystem. I'll need to send the data through the hasql connection.

If you're using libpq internally it has some functions for doing this: http://www.postgresql.org/docs/9.3/static/libpq-copy.html

@nikita-volkov
Copy link
Owner

A problem with this thing is that it only concerns Postgres, while Hasql is a general API.

I have some ideas concerning this feature though. One of them requires a major revision of the whole infrastructure of Hasql libraries and implementing this feature in the API of "hasql-postgres". Alternative idea is to introduce another class in "hasql-backend", which deals with this functionality in a general way, then drivers will optionally provide instances for that class depending on whether they support such functionality.

I like the first idea better, but I'll let it age for now. I will get back to this problem though when some other issues requiring a revision of the backend API will appear.

@diogob
Copy link
Contributor

diogob commented Jul 13, 2015

@nikita-volkov I'd love to help implementing this feature. Any thoughts on how to do it?

@nikita-volkov
Copy link
Owner

I think it should be done in the "hasql-postgres" library, since it is a
Postgres-specific feature. Concerning ways of implementing it, I haven't
considered it.
13 Июл 2015 г. 4:10 пользователь "Diogo Biazus" [email protected]
написал:

@nikita-volkov https://github.com/nikita-volkov I'd love to help
implementing this feature. Any thoughts on how to do it?


Reply to this email directly or view it on GitHub
#1 (comment).

@ocharles
Copy link

You may wish to change the label of this repository then, which is currently "An efficient PostgreSQL driver and a flexible mapping API" (emphasis mine)

@nikita-volkov
Copy link
Owner

@ocharles Hasql is no longer general. It's now specialised to Postgres only, hence the label.

@ocharles
Copy link

Ok, I thought that may be the case, but just wanted to check wrt the above comment.

@no-longer-on-githu-b
Copy link

If I were to implement this, in which way would I need to worry about the current dev branch?

@nikita-volkov
Copy link
Owner

@rightfold The dev branch represents the ongoing development of the next major release. It already is a complete reimplementation compared to "master" and probably will get more drastic changes applied. So if you want to contribute, you probably should just branch off from "master" and we'll figure something out about merging that into the new version, once it's stabilised.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants