Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self):
super(VerticaQueryBuilder, self).__init__(dialect=Dialects.VERTICA)
self._hint = None
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,
@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,
def __init__(self):
super(MySQLQueryBuilder, self).__init__(
dialect=Dialects.MYSQL, wrap_union_queries=False
)
self._duplicate_updates = []
self._modifiers = []
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,
def __init__(self):
super(SnowFlakeQueryBuilder, self).__init__(dialect=Dialects.SNOWFLAKE)
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,
def __init__(self):
super(OracleQueryBuilder, self).__init__(dialect=Dialects.ORACLE)