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 escape like helper #81

Open
gaborbernat opened this issue Nov 6, 2024 · 0 comments
Open

Add escape like helper #81

gaborbernat opened this issue Nov 6, 2024 · 0 comments

Comments

@gaborbernat
Copy link

This helper method should be part of the lib:

def escape_like(text: str) -> str:
    """Escape text for like.

    :param text: the raw text
    :return: escaped text
    """
    return text.replace("%", "\\%").replace("_", "\\%")

Example of other frameworks having this https://sqlalchemy-utils.readthedocs.io/en/stable/orm_helpers.html#escape-like

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