-
Notifications
You must be signed in to change notification settings - Fork 108
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
table.createWriteStream() #60
Comments
It's probably a bit tricky to properly implement, but it would be pretty neat. The questions to answer are:
I'll try to see if there's a plan for the official driver to provide something similar or if there's a plan to keep a connection open and just dump document in a table without sending a query. |
+1 this would be very nice |
@neumino I have a branch up that I was playing around with if you want to check it out: As far as your questions go:
|
I have a prototype in the branch I want to test that a bit more before releasing it though, but from my local tests, it works fine. |
@neumino I quite like your implementation, looking forward to using it! I did notice a couple potential issues though:
|
@marshall007, yep I'll make About |
Also, in |
Thanks @marshall007! |
So one remaining question is what to call the methods.
It's kind of verbose-ish methods. I'm leaning towards The |
I don't have strong opinions on this, but I like the unified I don't really understand what your intentions are with |
@marshall007 -- The TransformStream is just a WritableStream. it just outputs what you inserted (with the generated primary key), or in case of an update, the updated document. |
Released in 1.16.5. This requires node >= 0.12. I'm not super happy with the way Node fill the buffer, and especially how it can drain it. It's not as optimal as I would like to be. I'll probably try to send a PR to node itself. The final syntax is Extra note: Thanks @marshall007 for following up so far and providing valuable feedback! It helped a lot! |
I think the issue you're describing is related to joyent/node #7348 where the writable stream emits the I came across TomFrost/FlushWritable after digging through the related issues in node. It may be worthwhile to look at his workaround if you haven't already. Regardless, nice job and I'm glad to see this implemented! |
Thanks for the issue on the node repo. Now that I think about it, I could provide a better implementation for Transform (in case of an efficient Readable being piped, I should be able to always do batch insert of Thanks again @marshall007 for the useful feedback! |
I cannot internally pipe things, so I could make only Transform streams more efficient. Sorry for the multiple updates. It took a few tries, but I think this is a good implementation of a single-connection writable streams. @marshall007 -- if you drop by in the bay area, ping me, I'll treat you a beer :) |
@neumino haha, will do! |
Now that we have support for readable streams in
1.16
it would be nice if writable streams were implemented as well. I'm not sure what the API for this should look like given that the readable streams use thestream:true
optarg, but this is what I'm looking to do:In this example we're using JSONStream to parse a large JSON file and pipe the results straight into RethinkDB in batches of 200.
The text was updated successfully, but these errors were encountered: