You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@age.apache.org by GitBox <gi...@apache.org> on 2021/08/06 02:27:36 UTC

[GitHub] [incubator-age] Halkrine opened a new issue #103: How can I get values as specific type when using 'with'?

Halkrine opened a new issue #103:
URL: https://github.com/apache/incubator-age/issues/103


   From document, default query is here.
   
   `
   select *
   from cypher('test_graph', $$
   		match(v:Part) return v
   $$) as (result agtype)
   `
   That result of type is 'agtype'.
   
   In this situation, I create basic query using 'with'.
   
   `
   with a as(select *
   from cypher('test_graph', $$
   		match(v:Part) return v
   $$) as (result agtype))
   select a from a
   `
   
   Result of datatype of this query is 'record' as a. 
   
   So, I have a some questions.
   
   1) Can I cast default datatype except on 'record'?
   2) In this query, how can I get specific data(ex. select a.id as id)?
   #


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-age] shinhanbyeol edited a comment on issue #103: How can I get values as specific type when using 'with'?

Posted by GitBox <gi...@apache.org>.
shinhanbyeol edited a comment on issue #103:
URL: https://github.com/apache/incubator-age/issues/103#issuecomment-893996470


   Is this what you want?
   
   select "result", "id" from cypher('test_graph', $$ match(v:Part) where id(v) = 844424930131969 return v.part_num , id(v) $$) as (result text, id text);
   
   with a as(
   	select * from cypher('test_graph', $$ match(v:Part) where id(v) = 844424930131969 return v.part_num , id(v) $$) as (result text, id text)
   )
   select "result", "id" from a;
   
   
   ![image](https://user-images.githubusercontent.com/76985229/128456980-406a68d6-bf74-44f4-99ed-efcaf85276b5.png)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-age] shinhanbyeol commented on issue #103: How can I get values as specific type when using 'with'?

Posted by GitBox <gi...@apache.org>.
shinhanbyeol commented on issue #103:
URL: https://github.com/apache/incubator-age/issues/103#issuecomment-893996470


   Is this what you want?
   혹시 원하는 의도가 이것 인가요?
   
   select "result", "id" from cypher('test_graph', $$ match(v:Part) where id(v) = 844424930131969 return v.part_num , id(v) $$) as (result text, id text);
   
   with a as(
   	select * from cypher('test_graph', $$ match(v:Part) where id(v) = 844424930131969 return v.part_num , id(v) $$) as (result text, id text)
   )
   select "result", "id" from a;
   
   
   ![image](https://user-images.githubusercontent.com/76985229/128456980-406a68d6-bf74-44f4-99ed-efcaf85276b5.png)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-age] Halkrine commented on issue #103: How can I get values as specific type when using 'with'?

Posted by GitBox <gi...@apache.org>.
Halkrine commented on issue #103:
URL: https://github.com/apache/incubator-age/issues/103#issuecomment-893997641


   Oh yes. it's correct.
   
   Thanks to reply.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-age] Halkrine commented on issue #103: How can I get values as specific type when using 'with'?

Posted by GitBox <gi...@apache.org>.
Halkrine commented on issue #103:
URL: https://github.com/apache/incubator-age/issues/103#issuecomment-893990666


   Of course, it returns text type when I use cypher query only(as (result text)).
   I want know when I use 'with', how I get data that I wanted type.
   
   Here is returned value in queried that.
   ![1111](https://user-images.githubusercontent.com/8775202/128455689-2dded534-41a0-44fc-b920-8a478f89c69e.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-age] JoshInnis closed issue #103: How can I get values as specific type when using 'with'?

Posted by GitBox <gi...@apache.org>.
JoshInnis closed issue #103:
URL: https://github.com/apache/incubator-age/issues/103


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-age] shinhanbyeol commented on issue #103: How can I get values as specific type when using 'with'?

Posted by GitBox <gi...@apache.org>.
shinhanbyeol commented on issue #103:
URL: https://github.com/apache/incubator-age/issues/103#issuecomment-893986280


   I don't know English well, so I don't know if I understood your question well. If I understood your question well,
   I think this question can explain your curiosity.
   
   CREATE EXTENSION age;
   LOAD 'age';
   SET search_path = ag_catalog, "postgres", public;
   
   
   SELECT create_graph('test_graph');
   
   
   SELECT * from cypher('test_graph', $$
     CREATE (a:Part {part_num: '123'}), 
            (b:Part {part_num: '345'}), 
            (c:Part {part_num: '456'}), 
            (d:Part {part_num: '789'})
   $$) as (a agtype);
   
   
   select * from cypher('test_graph', $$ match(v:Part) where id(v) = 844424930131969 return v.part_num  $$) as (result text);
   
   
   
   with a as(select * from cypher('test_graph', $$ match(v:Part) where id(v) = 844424930131969 return v.part_num  $$) as (result text)) 
   select a from a;
   
   
   1. If the cypher query result is in text format, you can cast it in text format.
   2. To query using a specific id value, you can use the id function where id function.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org