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

Type not specified as int for endpoint_id get parameter in routes #451

Open
bhodges-navapbc opened this issue Mar 14, 2024 · 0 comments
Open

Comments

@bhodges-navapbc
Copy link
Contributor

Describe the bug
Due to a type mismatch within a generated sql query, graphs aren't populating at the endpoint-level, when postgres is used as the database. sqlite seems to be more forgiving and I couldn't reproduce there.

An example exception:

No commit has been made, due to the following error: (psycopg.errors.UndefinedFunction) operator does not exist: integer = character varying
LINE 3: WHERE "Request".endpoint_id = $1::VARCHAR AND "Request".time...
                                    ^
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
[SQL: SELECT "Request".time_requested AS "Request_time_requested" 
FROM "Request" 
WHERE "Request".endpoint_id = %(endpoint_id_1)s::VARCHAR AND "Request".time_requested >= %(time_requested_1)s::TIMESTAMP WITHOUT TIME ZONE AND "Request".time_requested <= %(time_requested_2)s::TIMESTAMP WITHOUT TIME ZONE]
[parameters: {'endpoint_id_1': '11', 'time_requested_1': datetime.datetime(2024, 2, 29, 0, 0), 'time_requested_2': datetime.datetime(2024, 3, 14, 23, 59, 59)}]
(Background on this error at: https://sqlalche.me/e/20/f405)

To Reproduce
Steps to reproduce the behavior:

  • Perform a base install, using postgres as the database.

  • Login, then click on an endpoint. Graphs won't populate, for example hitting /dashboard/endpoint/11/hourly_load

Expected behavior
Graphs would populate at the endpoint-level.

Additional context
I'll submit a PR for this shortly.

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

No branches or pull requests

1 participant