-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
CSV API #1021
Comments
Thanks for this proposal! Unfortunately, there are some issues with it, most of which stem from the somewhat poor design of the existing k6 APIs that you've chosen to emulate... The rest are due to the data/work streaming and segmentation functionality we want to have. Sorry for the long post in advance, but I'll try to explain what I mean and where we're trying to go with the new file/CSV/JSON/XML/etc. APIs. I'm not sure if I can currently propose an alternative API, since I have to think and research a bit more, but hopefully this summary of the situation will help me as well. So, to start with, the current
What we need instead is a new function, or more likely - a set of functions, that will satisfy some of our requirements:
Somewhat orthogonal to the above concepts, in all cases (plain strings, the 2 points above, maybe even binary data), we will also need a way for VUs to read the data bit by bit, in various increments - bytes, characters, lines, null,
It's in the second case where execution segments (#997) come in, since they offer a way to achieve non-overlapping reads of a single piece of static data without synchronization between VUs on different k6 instances. And even though the execution segments work for the new schedulers (#1007), it's not clear how we should expose them to the JS data traversal APIs. And it's currently an open question how we can allow users to loop over files multiple times. And how do we signal things like "end of file"... In any case, up until now, I was describing only raw files, but CSV/JSON/XML/HTML/etc. are things that would have to work on top of the above machinery. Or at least on top of the first set of functions for opening a file - CSV parsing should be able to work with a simple
So, to get back to your proposal, I'm against an Similarly, I think that the current I'll finish by saying that I actually like the parts of your proposal that deal with column names and header parsing! They are very intuitive and user-friendly. Some other CSV-specific comments:
And finally, links to some of the connected issues: #532, #592, #992, #997, #1020 |
I want know how implements this feature? can you give some advice? |
@greyireland, sorry for the late response, as I explained in my previous comment, implementing this is currently blocked by execution segments (implemented in #1007, which we'll hopefully soon finish and merge) and us not having a clear picture how the APIs that deal with streams/shared data/data partitioning/etc. should look like. You can relatively easily implement a streaming CSV reader for your use case, or adapt the one implemented in #612. Unfortunately, I can't guarantee that we'd merge something like that until we have a clearer idea how everything needs to look like. |
@greyireland , Did you archive your requirement ? |
yes,I read data from file and share the data. |
After an internal discussion, we've decided to close this task since the proposed API should be re-think and could be highly impacted by the new File API (in particular streaming). #2978 |
Trying to propose an API for the CSV item on the roadmap, something I can set a target for. What about this?
Suggesting here to include CSV parsing of files and response data. For files it can use streaming to minimize memory usage. I think segmenting is not yet deployed but a partitioning ability can be built in that segmenting can plug into.
A possible API in the init context. When segmenting these can access partitioned data.
A possible API for response data.
That leaves these options:
header
- Boolean. Interpret first line as column header. Return objects.columns
- Array. Explicit column names. Return objects.The text was updated successfully, but these errors were encountered: