-
Notifications
You must be signed in to change notification settings - Fork 110
Import type "array"? #496
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
Comments
"documents", "array", "list", "auto" are the valid values for "type" on the server side. |
The actual behavior of the server is somewhat confusing and/or the documentation is incorrect.
Test file: ["_key","value1","value2"]
["abc",25,"test"]
["foo","bar","baz"] If I use
An explicit
Nor does the apparent alias
Strangely, the import succeeds without
no
|
#496 (comment) describes the server's current behavior. |
Is CSV import distinct from array-style data ( ["_key","value1","value2"]
["abc",25,"test"]
["foo","bar","baz"] Document-style format is this: {"_key":"abc","value1":25,"value2":"test"}
{"_key":"foo","value1":"bar","value2":"baz"} I don't really understand the purpose of
Without a type attribute, the array-style format is expected and it works for that format. It fails for document-style data, which is somewhat expected. Would it be possible to fix
The documentation needs fixing to properly explain when to set which parameter values (it is at least described in a confusing way) and should mention aliases if available. |
"list" was our old name for "array" (remember we did some internal renaming from "list" to "array" a long time ago). "list" was simply kept to keep it downwards-compatible. The server-side behavior is as follows:
|
I see. So there's a total of 4 formats:
I wasn't aware that JSONL also permits arrays at the top level - but since it is line-based JSON and top-level arrays are perfectly fine in JSON, it makes sense. It is not clear from the docs however, what the supported formats are and how to use the type parameter correctly. I suggest we add format examples and a description of them at the top. |
I'm pretty sure the current logic in arangojs is wrong. If this can be clarified, I'd love to fix it. Maybe we can also clarify it right in the docs so other API users and driver maintainers will know what to do. |
@pluma arangojs seems to default to I don't particularly like the fact that there is no actual type for CSV-style arrays. It would be much easier to understand if we had a distinct option to use it. Not sure what to call it though, "csv-arrays"? |
For imports, there is a check
type !== "array"
:isJsonStream: Boolean(!opts || opts.type !== "array"),
https://github.com/arangodb/arangojs/blob/master/src/collection.ts#L351
According to the HTTP API docs, only the following are supported:
auto
,documents
,list.
Either the documentation is lacking, or it needs to be changed to
list
in arangojs.The text was updated successfully, but these errors were encountered: