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

Tests failing due to unescaped quotes in string values #3050

Closed
1 task done
mdragon opened this issue Nov 26, 2024 · 0 comments · Fixed by #3051
Closed
1 task done

Tests failing due to unescaped quotes in string values #3050

mdragon opened this issue Nov 26, 2024 · 0 comments · Fixed by #3051
Assignees
Labels

Comments

@mdragon
Copy link
Collaborator

mdragon commented Nov 26, 2024

Summary

https://github.com/HHS/simpler-grants-gov/actions/runs/12035279047/job/33553855406#step:8:250

        except e._NO_TRACEBACK as ex:
>           raise ex.with_traceback(None)
E           sqlalchemy.exc.ProgrammingError: (psycopg.errors.SyntaxError) syntax error at or near "s"
E           LINE 1: ...,'WW-13-WHH-946',5,'Research into Nurse, children's industry...
E                                                                        ^
E           [SQL: INSERT INTO test_315813624763377096677135540095373709572_legacy.topportunity (opportunity_id,oppnumber,revision_number,opptitle,owningagency,publisheruid,listed,oppcategory,initial_opportunity_id,modified_comments,created_date,last_upd_date,creator_id,last_upd_id,flag_2006,category_explanation,publisher_profile_id,is_draft) VALUES (106,'WW-13-WHH-946',5,'Research into Nurse, children's industry','USAID',NULL,NULL,'O',NULL,NULL,'2016-05-20T23:16:32.253768',NULL,NULL,NULL,NULL,'Whose whose story purpose none small.',NULL,'N')]
E           (Background on this error at: https://sqlalche.me/e/20/f405)

/home/runner/.cache/pypoetry/virtualenvs/simpler-grants-gov-api-cCrPfAjT-py3.13/lib/python3.13/site-packages/psycopg/cursor.py:97: ProgrammingError
self = <psycopg.Cursor [closed] [INERROR] (host=grants-db database=app) at 0x7f3b158abb90>
query = "INSERT INTO test_315813624763377096677135540095373709572_legacy.topportunity (opportunity_id,oppnumber,revision_numbe...,NULL,'O',NULL,NULL,'2016-05-20T23:16:32.253768',NULL,NULL,NULL,NULL,'Whose whose story purpose none small.',NULL,'N')"
params = {}

    def execute(
        self,
        query: Query,
        params: Params | None = None,
        *,
        prepare: bool | None = None,
        binary: bool | None = None,
    ) -> Self:
        """
        Execute a query or command to the database.
        """
        try:
            with self._conn.lock:
                self._conn.wait(
                    self._execute_gen(query, params, prepare=prepare, binary=binary)
                )
        except e._NO_TRACEBACK as ex:
>           raise ex.with_traceback(None)
E           psycopg.errors.SyntaxError: syntax error at or near "s"
E           LINE 1: ...,'WW-13-WHH-946',5,'Research into Nurse, children's industry...
E                                                                        ^

/home/runner/.cache/pypoetry/virtualenvs/simpler-grants-gov-api-cCrPfAjT-py3.13/lib/python3.13/site-packages/psycopg/cursor.py:97: SyntaxError

Reproducibility

I tried multiple times and saw the bug intermittently

How to reproduce the bug

Run make tests

Browser

Not applicable

Code of Conduct

  • I agree to follow this project's Code of Conduct
@mdragon mdragon added the api label Nov 26, 2024
@mdragon mdragon self-assigned this Nov 26, 2024
mdragon added a commit that referenced this issue Nov 26, 2024
## Summary
Fixes #3050 

### Time to review: __2 mins__

## Changes proposed
Make sure we're escaping single quotes in our DB strings

## Context for reviewers
Tests started failing due to a string with "children's" in it
All tests are now passing locally
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

1 participant