diff --git a/pypika/dialects.py b/pypika/dialects.py index 8894e562..0d247ad2 100644 --- a/pypika/dialects.py +++ b/pypika/dialects.py @@ -874,6 +874,8 @@ def __init__(self, **kwargs: Any) -> None: super().__init__(dialect=Dialects.SQLLITE, wrapper_cls=SQLLiteValueWrapper, **kwargs) self._insert_or_replace = False + _ignore_syntax = "OR IGNORE " + @builder def insert_or_replace(self, *terms: Any) -> "SQLLiteQueryBuilder": self._apply_terms(*terms) diff --git a/pypika/queries.py b/pypika/queries.py index c51c6b2b..d8ca4ab9 100644 --- a/pypika/queries.py +++ b/pypika/queries.py @@ -1407,10 +1407,12 @@ def _select_sql(self, **kwargs: Any) -> str: select=",".join(term.get_sql(with_alias=True, subquery=True, **kwargs) for term in self._selects), ) + _ignore_syntax = "IGNORE " + def _insert_sql(self, **kwargs: Any) -> str: return "INSERT {ignore}INTO {table}".format( table=self._insert_table.get_sql(**kwargs), - ignore="IGNORE " if self._ignore else "", + ignore=self._ignore_syntax if self._ignore else "", ) def _replace_sql(self, **kwargs: Any) -> str: