How to use the pypika.enums.Dialects function in PyPika

To help you get started, we’ve selected a few PyPika examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kayak / pypika / pypika / dialects.py View on Github external
def __init__(self):
        super(VerticaQueryBuilder, self).__init__(dialect=Dialects.VERTICA)
        self._hint = None
github kayak / pypika / pypika / terms.py View on Github external
def get_special_params_sql(self, **kwargs):
        if self._ignore_nulls:
            return "IGNORE NULLS"

        # No special params unless ignoring nulls
        return None


class Interval:
    templates = {
        # MySQL requires no single quotes around the expr and unit
        Dialects.MYSQL: "INTERVAL {expr} {unit}",
        # PostgreSQL, Redshift and Vertica require quotes around the expr and unit e.g. INTERVAL '1 week'
        Dialects.POSTGRESQL: "INTERVAL '{expr} {unit}'",
        Dialects.REDSHIFT: "INTERVAL '{expr} {unit}'",
        Dialects.VERTICA: "INTERVAL '{expr} {unit}'",
        # Oracle requires just single quotes around the expr
        Dialects.ORACLE: "INTERVAL '{expr}' {unit}",
    }

    units = ["years", "months", "days", "hours", "minutes", "seconds", "microseconds"]
    labels = ["YEAR", "MONTH", "DAY", "HOUR", "MINUTE", "SECOND", "MICROSECOND"]

    trim_pattern = re.compile(r"(^0+\.)|(\.0+$)|(^[0\-.: ]+[\-: ])|([\-:. ][0\-.: ]+$)")

    def __init__(
        self,
        years=0,
        months=0,
        days=0,
        hours=0,
github kayak / pypika / pypika / terms.py View on Github external
    @builder
    def ignore_nulls(self):
        self._ignore_nulls = True

    def get_special_params_sql(self, **kwargs):
        if self._ignore_nulls:
            return "IGNORE NULLS"

        # No special params unless ignoring nulls
        return None


class Interval:
    templates = {
        # MySQL requires no single quotes around the expr and unit
        Dialects.MYSQL: "INTERVAL {expr} {unit}",
        # PostgreSQL, Redshift and Vertica require quotes around the expr and unit e.g. INTERVAL '1 week'
        Dialects.POSTGRESQL: "INTERVAL '{expr} {unit}'",
        Dialects.REDSHIFT: "INTERVAL '{expr} {unit}'",
        Dialects.VERTICA: "INTERVAL '{expr} {unit}'",
        # Oracle requires just single quotes around the expr
        Dialects.ORACLE: "INTERVAL '{expr}' {unit}",
    }

    units = ["years", "months", "days", "hours", "minutes", "seconds", "microseconds"]
    labels = ["YEAR", "MONTH", "DAY", "HOUR", "MINUTE", "SECOND", "MICROSECOND"]

    trim_pattern = re.compile(r"(^0+\.)|(\.0+$)|(^[0\-.: ]+[\-: ])|([\-:. ][0\-.: ]+$)")

    def __init__(
        self,
        years=0,
github kayak / pypika / pypika / dialects.py View on Github external
def __init__(self):
        super(MySQLQueryBuilder, self).__init__(
            dialect=Dialects.MYSQL, wrap_union_queries=False
        )
        self._duplicate_updates = []
        self._modifiers = []
github kayak / pypika / pypika / terms.py View on Github external
def get_special_params_sql(self, **kwargs):
        if self._ignore_nulls:
            return "IGNORE NULLS"

        # No special params unless ignoring nulls
        return None


class Interval:
    templates = {
        # MySQL requires no single quotes around the expr and unit
        Dialects.MYSQL: "INTERVAL {expr} {unit}",
        # PostgreSQL, Redshift and Vertica require quotes around the expr and unit e.g. INTERVAL '1 week'
        Dialects.POSTGRESQL: "INTERVAL '{expr} {unit}'",
        Dialects.REDSHIFT: "INTERVAL '{expr} {unit}'",
        Dialects.VERTICA: "INTERVAL '{expr} {unit}'",
        # Oracle requires just single quotes around the expr
        Dialects.ORACLE: "INTERVAL '{expr}' {unit}",
    }

    units = ["years", "months", "days", "hours", "minutes", "seconds", "microseconds"]
    labels = ["YEAR", "MONTH", "DAY", "HOUR", "MINUTE", "SECOND", "MICROSECOND"]

    trim_pattern = re.compile(r"(^0+\.)|(\.0+$)|(^[0\-.: ]+[\-: ])|([\-:. ][0\-.: ]+$)")

    def __init__(
        self,
        years=0,
        months=0,
        days=0,
        hours=0,
        minutes=0,
github kayak / pypika / pypika / dialects.py View on Github external
def __init__(self):
        super(SnowFlakeQueryBuilder, self).__init__(dialect=Dialects.SNOWFLAKE)
github kayak / pypika / pypika / terms.py View on Github external
return "IGNORE NULLS"

        # No special params unless ignoring nulls
        return None


class Interval:
    templates = {
        # MySQL requires no single quotes around the expr and unit
        Dialects.MYSQL: "INTERVAL {expr} {unit}",
        # PostgreSQL, Redshift and Vertica require quotes around the expr and unit e.g. INTERVAL '1 week'
        Dialects.POSTGRESQL: "INTERVAL '{expr} {unit}'",
        Dialects.REDSHIFT: "INTERVAL '{expr} {unit}'",
        Dialects.VERTICA: "INTERVAL '{expr} {unit}'",
        # Oracle requires just single quotes around the expr
        Dialects.ORACLE: "INTERVAL '{expr}' {unit}",
    }

    units = ["years", "months", "days", "hours", "minutes", "seconds", "microseconds"]
    labels = ["YEAR", "MONTH", "DAY", "HOUR", "MINUTE", "SECOND", "MICROSECOND"]

    trim_pattern = re.compile(r"(^0+\.)|(\.0+$)|(^[0\-.: ]+[\-: ])|([\-:. ][0\-.: ]+$)")

    def __init__(
        self,
        years=0,
        months=0,
        days=0,
        hours=0,
        minutes=0,
        seconds=0,
        microseconds=0,
github kayak / pypika / pypika / dialects.py View on Github external
def __init__(self):
        super(OracleQueryBuilder, self).__init__(dialect=Dialects.ORACLE)