You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been using SurrealDB for a while now and have encountered several scenarios where I need to create a view from a table that contains an array field. In these cases, I want to use the SPLIT feature, similar to the $unwind functionality in MongoDB, to separate the elements of the array into individual records.
Currently, my attempts to use the SPLIT feature in a DEFINE TABLE statement result in an error. Here is an example of the query I attempted:
DEFINE TABLE MyView ASSELECT a, arrayField FROM MyTable SPLIT arrayField;
The error message I received was:
expected query to end
|
1 | DEFINE TABLE MyView ASSELECT a, arrayField FROM MyTable SPLIT arrayField...
| ^ perhaps missing a semicolon on the previous statement?
Describe the solution
To enhance SurrealDB, I suggest adding support for the SPLIT feature within the DEFINE TABLE statement. This would allow users to create views that effectively handle array fields by splitting them into separate records, making the database more versatile and powerful for complex data transformations.
This discussion was converted from issue #599 on June 15, 2024 12:05.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Is your feature request related to a problem?
I've been using
SurrealDB
for a while now and have encountered several scenarios where I need to create a view from a table that contains an array field. In these cases, I want to use theSPLIT
feature, similar to the$unwind
functionality in MongoDB, to separate the elements of the array into individual records.Currently, my attempts to use the
SPLIT
feature in aDEFINE TABLE
statement result in an error. Here is an example of the query I attempted:The error message I received was:
Describe the solution
To enhance
SurrealDB
, I suggest adding support for theSPLIT
feature within theDEFINE TABLE
statement. This would allow users to create views that effectively handle array fields by splitting them into separate records, making the database more versatile and powerful for complex data transformations.Alternative methods
NONE
Contact Details
[email protected]
Is there an existing issue for this?
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions