def orderby(self, orders: Iterable[str]): __orders = quote_join('"', orders) return Query(f'{self.sql} ORDER BY {__orders}', self.values)
def __init__(self, cols: Iterable, table: str): __columns = quote_join('"', cols) self.sql = f'SELECT DISTINCT {__columns} FROM "{table}"' self.cols = cols self.values = None
def __init__(self, table: str, cols: Iterable): __columns = quote_join('"', cols) __values = ', '.join([f'${i+1}' for i in range(len(cols))]) self.sql = f'INSERT INTO "{table}"({__columns}) VALUES({__values})'