Appending / array literals


#1

I’m playing with scidb 12.10. I’d like to create a “table like” array, i.e. a one-dimensional array with multiple attributes, and append “rows” to it. Yes, I realize that scidb isn’t designed for this use-case, but I’d like to keep my data and my metadata all in one place.

In my testing, when I use insert into statements with array literals, I keep overwriting the first “row”:

AQL% create array projectsid:string,name:string[index=0:*,100000,0];
Query was executed successfully
AQL% insert into projects ‘[(123,foo)]’;
[{0}(“123”,“foo”)]
AQL% insert into projects ‘[(456,bar)]’;
[{0}(“456”,“bar”)]
AQL% select * from projects;
[{0}(“456”,“bar”)]

… is there a way to set the dimensions for an array literal so it doesn’t keep overwriting the first row, or a better way to do this altogether?

Cheers,
Tim


#2

OK, just realized that I can use

AQL% insert into projects ‘[{1}[456,bar)]’

to specify the “row” where the data is inserted. This gets the job done, albeit with the usual potential race conditions around having to retrieve the current size of the array before doing an insert. I recognize that the semantics of “append” get tricky when there are multiple dimensions to choose from, but I think it would be incredibly useful for anyone who, like me, wants to use scidb as the backend for a tool where we need to keep track of a data model in addition to the raw data.

Cheers,
Tim