Skip to content
This repository was archived by the owner on Sep 16, 2025. It is now read-only.

Conversation

jasonf20
Copy link
Contributor

@jasonf20 jasonf20 commented May 16, 2023

Queries such as SHOW CREATE JOB <job_name> return scalar results. A scalar result is returned as:

[
    {
        "status": "Success",
        "kind": "upsolver_scalar_query_response",
        "result":
        {
            "scalar":
            {
                "value": "<value_here>",
                "valueType": "<value_type_here>"
            }
        }
    }
]

This commit transforms this result into a 1x1 grid with a column name of
valueType.

@jasonf20 jasonf20 requested a review from tanyshak May 16, 2023 13:42
navado
navado previously approved these changes May 16, 2023
@navado navado dismissed their stale review May 16, 2023 14:30

Need to amend

@navado navado self-requested a review May 16, 2023 14:31
Copy link
Collaborator

@navado navado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add example of this query to examples and test case to DB API tests?

@jasonf20
Copy link
Contributor Author

I didn’t see a way to add a test easily since the test_dbapi.py file doesn’t mock the entire response, it mocks just the grid, so that wouldn’t test anything. Since the change happens in the response parsing which I didn't see an existing spec for.
If there is a place to add this please let me know where.

I also don’t think it really is required in the example since it’s just another query from the user’s perspective. In addition there isn't a section about creating jobs right now so there also isn't a good place to add it to in the README.

@jasonf20 jasonf20 requested a review from navado May 16, 2023 14:42
A scalar result is returned as:

```
[
    {
        "status": "Success",
        "kind": "upsolver_scalar_query_response",
        "result":
        {
            "scalar":
            {
                "value": "<value_here>",
                "valueType": "<value_type_here>"
            }
        }
    }
]
```

This commit transforms this result into a 1x1 grid with a column name of
`valueType`.
@jasonf20 jasonf20 force-pushed the support-scalar-queries branch from 1551a28 to 0732860 Compare May 16, 2023 15:16
@jasonf20
Copy link
Contributor Author

Added an example how this would be used in the examples.py file

@navado navado merged commit c555cb1 into develop May 16, 2023
@jasonf20 jasonf20 deleted the support-scalar-queries branch May 16, 2023 18:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants