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

Add quering references #284

Merged
merged 6 commits into from
May 12, 2023
Merged

Add quering references #284

merged 6 commits into from
May 12, 2023

Conversation

dirkkul
Copy link
Collaborator

@dirkkul dirkkul commented Apr 11, 2023

Usage:

result = client.query.get(
  "Article", ["title", "url", "wordCount", Reference(reference_property="inPublication", linked_class="Publication", properties=["name", "founded_in"]
            )]
     )

which is equivalent to

result = client.query.get(
  "Article", ["title", "url", "wordCount", 
     "inPublication {... on Publication {name founded_in}}"]
     )

For nested requests it looks like this:

client.query.get(
        "D",
        [
            "nonRef",
            Reference(
                reference_property="refC",
                linked_class="C",
                properties=[
                    "nonRef",
                    Reference(
                        reference_property="refB",
                        linked_class="B",
                        properties=[
                            "nonRef",
                            Reference(
                                reference_property="refA", linked_class="A", properties=["nonRef"]
                            ),
                        ],
                    ),
                ],
            ),
            Reference(
                reference_property="refB",
                linked_class="B",
                properties=[
                    "nonRef",
                    Reference(reference_property="refA", linked_class="A", properties=["nonRef"]),
                ],
            ),
        ],
    ).do()

@dirkkul dirkkul marked this pull request as draft April 11, 2023 16:09
@codecov-commenter
Copy link

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02 🎉

Comparison is base (7dfdd9b) 96.49% compared to head (04098c4) 96.52%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #284      +/-   ##
==========================================
+ Coverage   96.49%   96.52%   +0.02%     
==========================================
  Files          64       64              
  Lines        7653     7707      +54     
==========================================
+ Hits         7385     7439      +54     
  Misses        268      268              
Impacted Files Coverage Δ
integration/test_crud.py 100.00% <100.00%> (ø)
test/gql/test_get.py 100.00% <100.00%> (ø)
weaviate/gql/get.py 99.63% <100.00%> (+0.01%) ⬆️
weaviate/gql/query.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

weaviate/gql/get.py Outdated Show resolved Hide resolved
@dirkkul dirkkul marked this pull request as ready for review May 11, 2023 15:36
@dirkkul dirkkul requested a review from a team as a code owner May 11, 2023 15:36
@dirkkul dirkkul requested a review from StefanBogdan May 11, 2023 15:36
weaviate/gql/get.py Outdated Show resolved Hide resolved
weaviate/gql/get.py Show resolved Hide resolved
@dirkkul dirkkul merged commit 3ecacaa into main May 12, 2023
@dirkkul dirkkul deleted the beacon_refs branch May 12, 2023 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants