Skip to content
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

insert into A from ( select @rid as link from B ) dont work #2408

Closed
publicocean0 opened this issue May 29, 2014 · 6 comments
Closed

insert into A from ( select @rid as link from B ) dont work #2408

publicocean0 opened this issue May 29, 2014 · 6 comments

Comments

@publicocean0
Copy link

I have a simple class A { B link }
where B is a class

insert into A from ( select @Rid as link from B )

dont work

@enisher
Copy link
Contributor

enisher commented May 29, 2014

Duplication #2404

@publicocean0
Copy link
Author

i m sorry for the duplication :(
The scope is to create as many class A as many class B in which a property of A (link) is set with the corrisponding B reference.
Obviusly it is a semplified query, now it have no sense: the nested query will comprehend also a filter, but i tested if it is possible to do.
Then it is not clear if it will could be used for a massive read.
In general every command return a list. I suppose that this list is loaded enterely in memory.
Instead, I supposed that using this multple insert , internaly orientdb load a item , one by one, and associate it to property A.link.
I tried also to use "create edge from A to B..." , but then A and B dint extend V, so when i execute select both() from A or B dont see anything( Using Vertex yes).
In addition remains the same question creating edge from a select ... the nested select is loaded all in memory?
So for being sure to not load all in memory , I tried to use AsyncQuery from server side (see issue notified for it). In this way for each document loaded i can insert my logic with other inserction and code. I dont find in the wiki other possible solution, sincerely.

Returning anyway to multiple insert :
Also removing parenthesis dont' work.

orientdb {test3}> select from bb                                 

----+-----+----+--------+-----
#   |@RID |name|in_     |in_ee
----+-----+----+--------+-----
0   |#71:0|c   |[size=2]|#72:0
1   |#71:1|a   |#72:0   |#72:0
2   |#71:2|b   |#72:0   |#72:0
3   |#71:3|d   |#72:0   |#72:0
----+-----+----+--------+-----

4 item(s) found. Query executed in 0.041 sec(s).
orientdb {test3}> insert into aa from select @rid as link from bb

Inserted record '[]' in 0,002000 sec(s).

Alfo

@lvca
Copy link
Member

lvca commented May 29, 2014

Have you tried

insert into aa from select from bb

@lvca lvca reopened this May 29, 2014
@publicocean0
Copy link
Author

orientdb {test3}> insert into aa from select from bb

Inserted record '[]' in 0,001000 sec(s).

I suppose it is still a array empty

@lvca
Copy link
Member

lvca commented May 29, 2014

Weird, we've test cases on that. Are you using 1.7?

@publicocean0
Copy link
Author

yes, 1.7.rc2
Bottom the console text:

orientdb {test3}> select * from aa


0 item(s) found. Query executed in 0.001 sec(s).
orientdb {test3}> select * from bb

----+-----+----+--------+-----
#   |@RID |name|in_     |in_ee
----+-----+----+--------+-----
0   |#71:0|c   |[size=2]|#72:0
1   |#71:1|a   |#72:0   |#72:0
2   |#71:2|b   |#72:0   |#72:0
3   |#71:3|d   |#72:0   |#72:0
----+-----+----+--------+-----

4 item(s) found. Query executed in 0.007 sec(s).
orientdb {test3}> insert into aa from select from bb

Inserted record '[]' in 0,001000 sec(s).

orientdb {test3}> select * from aa                  


0 item(s) found. Query executed in 0.002 sec(s).
orientdb {test3}> 

@lvca lvca closed this as completed Jan 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants