import sqlparse

NO_SELECT_LIMIT_VALUE = -1


def get_limit_expression(limit: int) -> str:
    return "" if limit == NO_SELECT_LIMIT_VALUE else f" LIMIT {limit}"


def format_sql(
    query,
    reindent=True,
    keyword_case=None,
    identifier_case=None,
    strip_comments=False,
    strip_whitespace=True,
    output_format="sql",
):
    return sqlparse.format(
        query,
        reindent=reindent,
        keyword_case=keyword_case,
        identifier_case=identifier_case,
        strip_comments=strip_comments,
        strip_whitespace=strip_whitespace,
        output_format=output_format,
    )
