Skip to content

Instantly share code, notes, and snippets.

@amyreese
Created December 19, 2018 06:00
Show Gist options
  • Save amyreese/0da753bfd9a218d494bd10a7b401ce4f to your computer and use it in GitHub Desktop.
Save amyreese/0da753bfd9a218d494bd10a7b401ce4f to your computer and use it in GitHub Desktop.
(.venv) jreese@legion ~/workspace/aql master » bowler do 'Query().select_class("Operation").rename("Comparison").diff()'
--- ./aql/column.py
+++ ./aql/column.py
@@ -11,7 +11,7 @@
@dataclass
-class Operation:
+class Comparison:
column: "Column"
operator: Operator
value: Any
--- ./aql/column.py
+++ ./aql/column.py
@@ -26,28 +26,28 @@
self.default = default
def in_(self, values: Sequence[Any]) -> Operation:
- return Operation(self, Operator.in_, list(values))
+ return Comparison(self, Operator.in_, list(values))
def like(self, value: str) -> Operation:
- return Operation(self, Operator.like, value)
+ return Comparison(self, Operator.like, value)
def ilike(self, value: str) -> Operation:
- return Operation(self, Operator.ilike, value)
+ return Comparison(self, Operator.ilike, value)
def __eq__(self, value: Any) -> Operation: # type: ignore
- return Operation(self, Operator.eq, value)
+ return Comparison(self, Operator.eq, value)
def __ne__(self, value: Any) -> Operation: # type: ignore
- return Operation(self, Operator.ne, value)
+ return Comparison(self, Operator.ne, value)
def __gt__(self, value: Any) -> Operation:
- return Operation(self, Operator.gt, value)
+ return Comparison(self, Operator.gt, value)
def __ge__(self, value: Any) -> Operation:
- return Operation(self, Operator.ge, value)
+ return Comparison(self, Operator.ge, value)
def __lt__(self, value: Any) -> Operation:
- return Operation(self, Operator.lt, value)
+ return Comparison(self, Operator.lt, value)
def __le__(self, value: Any) -> Operation:
- return Operation(self, Operator.le, value)
+ return Comparison(self, Operator.le, value)
--- ./aql/tests/column.py
+++ ./aql/tests/column.py
@@ -6,7 +6,7 @@
class ColumnTest(TestCase):
def test_column_comparisons(self):
- from aql.column import Column, Operation
+ from aql.column import Column, Comparison
from aql.types import Operator
column = Column(name="foo", ctype=int)
--- ./aql/tests/table.py
+++ ./aql/tests/table.py
@@ -4,7 +4,7 @@
from typing import NamedTuple
from unittest import TestCase
-from aql.column import Column, Operation
+from aql.column import Column, Comparison
from aql.table import Table, table
from aql.types import Operator
--- ./aql/tests/table.py
+++ ./aql/tests/table.py
@@ -20,7 +20,7 @@
self.assertIs(col, tcol)
self.assertIs(col, getattr(tbl, col.name))
- self.assertEqual(tbl.foo == 5, Operation(columns[2], Operator.eq, 5))
+ self.assertEqual(tbl.foo == 5, Comparison(columns[2], Operator.eq, 5))
def test_table_decorator_basic(self):
@table
Error: query failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment