Replies: 10 comments 4 replies
-
|
@wgmayer0 Could you elaborate as to what your end goal is? Why is the data so spread out? Also, have you tried asking Gemini or Copilot to simplify the query? They are actually fairly decent helping out with simplifications and explanations. |
Beta Was this translation helpful? Give feedback.
-
|
Ive asked chatgpt haha. It is hallucinating solutions. This is usually my
last resort. Is gemini/copilot better to use for this? And yeah, each state
of point is essentially its own node because for example, person can change
companies and then the data will all have to move to the new company, so it
doesn't make sense to list it all in the same node. The core logic Is in
the graph query, but I don't want to have to be this explicit just to get a
json object of the data
…On Tue, Sep 30, 2025 at 1:54 PM John Gemignani ***@***.***> wrote:
@wgmayer0 <https://github.com/wgmayer0> Could you elaborate as to what
your end goal is? Why is the data so spread out?
Also, have you tried asking Gemini or Copilot to simplify the query? They
are actually fairly decent helping out with simplifications and
explanations.
—
Reply to this email directly, view it on GitHub
<#2226 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ARTB5TOGFSGKK5NE3XZIH6D3VK7WNAVCNFSM6AAAAACH5EN6SKVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTINJVGU3DENY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
@wgmayer0 I use Copilot, but generally speaking, if you can constrain the AI, you can get decent results. As for your query, I will leave you with this snippet, which should help you out - |
Beta Was this translation helpful? Give feedback.
-
|
Hmm. I can't get this to run:
```
SELECT *
FROM cypher('hermech', $$
MATCH (b:contact_name)
RETURN pg_catalog.json_build_object(label(b)::text, b.value::pg_text)
$$) as (result json);
```
…On Tue, Sep 30, 2025 at 2:35 PM John Gemignani ***@***.***> wrote:
@wgmayer0 <https://github.com/wgmayer0> I use Copilot, but generally
speaking, if you can constrain the AI, you can get decent results. As for
your query, I will leave you with this snippet, which should help you out -
psql-17.6-5432-pgsql=# select * from cypher('graph', $$ match (b:Book) return pg_catalog.json_build_object(label(b)::text, b.title::pg_text) $$) as (result json);
result
------------------
{"Book" : "Qrs"}
{"Book" : "Qrs"}
{"Book" : "Qrs"}
{"Book" : "Xyz"}
{"Book" : "Abc"}
{"Book" : "Abc"}
{"Book" : "Abc"}
(7 rows)
—
Reply to this email directly, view it on GitHub
<#2226 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ARTB5TONSTU5JBS2SRT3ZIT3VLEP7AVCNFSM6AAAAACH5EN6SKVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTINJVGU4TKNI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
Does your code run? It's saying b.title is invalid
…On Tue, Sep 30, 2025 at 2:35 PM John Gemignani ***@***.***> wrote:
@wgmayer0 <https://github.com/wgmayer0> I use Copilot, but generally
speaking, if you can constrain the AI, you can get decent results. As for
your query, I will leave you with this snippet, which should help you out -
psql-17.6-5432-pgsql=# select * from cypher('graph', $$ match (b:Book) return pg_catalog.json_build_object(label(b)::text, b.title::pg_text) $$) as (result json);
result
------------------
{"Book" : "Qrs"}
{"Book" : "Qrs"}
{"Book" : "Qrs"}
{"Book" : "Xyz"}
{"Book" : "Abc"}
{"Book" : "Abc"}
{"Book" : "Abc"}
(7 rows)
—
Reply to this email directly, view it on GitHub
<#2226 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ARTB5TONSTU5JBS2SRT3ZIT3VLEP7AVCNFSM6AAAAACH5EN6SKVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTINJVGU4TKNI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
True lol.
```
postgres=# SELECT *
FROM cypher('hermech', $$
MATCH (b:contact_name)
RETURN pg_catalog.json_build_object(label(b)::text, b.value::pg_text)
$$) as (result json);
ERROR: invalid indirection syntax
LINE 4: ...TURN pg_catalog.json_build_object(label(b)::text, b.value::p...
^
```
…On Tue, Sep 30, 2025 at 4:24 PM John Gemignani ***@***.***> wrote:
@wgmayer0 <https://github.com/wgmayer0> The command ran, as you can see
the output :)
You will need to provide your output, if it isn't working.
—
Reply to this email directly, view it on GitHub
<#2226 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ARTB5TOA6BGJ4JPNEL7NIJT3VLRHJAVCNFSM6AAAAACH5EN6SKVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTINJVGY2TMOA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
Not sure what to tell you - Which PG/AGE version are you using? |
Beta Was this translation helpful? Give feedback.
-
|
Here's my solution: If anyone can think of ways to simplify it that would be nice. I am essentially writing the values I want in 4 different places which seems a little ridiculous. As for my version:
|
Beta Was this translation helpful? Give feedback.
-
|
@wgmayer0 You don't need to use |
Beta Was this translation helpful? Give feedback.
-
|
Closest I've gotten to simplifying my solution is this: But |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a way to get rid of all of the redundancy? Is it possible to simplify this query? Also am I able to remove null keys from the final json object returned?
Beta Was this translation helpful? Give feedback.
All reactions