Skip to content

Supported ColumnProxy methods with @escript decorator

Listed below methods are supported in decorated with @escript methods of "epurized" class such as those described in @escript section here

Methods below demonstrate how operators in Epure will be translated in SQL and the class used in examples will be declared here:

    @epure
    class MyEpureCls:
        my_str_field:str
        my_int_field:int

Operators Precedence

Precedence of these operators are same as in SQL and brackets does not affect precedence (at least for now).

1) Equality operator "=="

In Epure: == -> In sql: =

Example for == operator

@escript
def my_decorated_method():
    self.md.my_str_field == "Honesty is the best policy"
Will be in SQL:
SELECT * 
FROM public.my_epure_cls 
WHERE my_str_field = "Honesty is the best policy"

2) Inequality operator "!="

In Epure: != -> In sql: <>

Example for != operator

@escript
def my_decorated_method():
    self.md.my_str_field != "Honesty is the best policy"
Will be in SQL:
SELECT * 
FROM public.my_epure_cls 
WHERE my_str_field <> "Honesty is the best policy"

3) More and more or equals operator ">" and ">="

In Epure: > -> In sql: >

In Epure: >= -> In sql: >=

Example for > and >= operator

@escript
def my_decorated_method():
    self.md.my_int_field > "42"
    self.md.my_int_field >= "80"
Will be in SQL:
SELECT * 
FROM public.my_epure_cls 
WHERE my_int_field > 42

SELECT * 
FROM public.my_epure_cls 
WHERE my_int_field >= 80

4) Less and less or equals operator "<" and "<="

In Epure: < -> In sql: <

In Epure: <= -> In sql: <=

Example for < and <= operator

@escript
def my_decorated_method():
    self.md.my_int_field < "42"
    self.md.my_int_field <= "80"
Will be in SQL:
SELECT * 
FROM public.my_epure_cls 
WHERE my_int_field < 42

SELECT * 
FROM public.my_epure_cls 
WHERE my_int_field <= 80

5) Not operator "not"

In Epure: not -> In sql: NOT

Example for not operator

@escript
def my_decorated_method():
    not self.md.my_int_field > 66
Will be in SQL:
SELECT * 
FROM public.my_epure_cls 
WHERE NOT my_int_field > 66

6) Not in operator "not in"

In Epure: not in -> In sql: NOT IN

Example for not in operator

@escript
def my_decorated_method():
    self.md.my_str_field not in ("dog", "goes", "woof")
Will be in SQL:
SELECT * 
FROM public.my_epure_cls
WHERE my_str_field NOT IN ("dog", "goes", "woof")

7) And operator "and"

In Epure: and -> In sql: AND

Example for and operator

@escript
def my_decorated_method():
    self.md.my_str_field == "Milky Galaxy" and self.md.my_int_field != 90
Will be in SQL:
SELECT * 
FROM public.my_epure_cls
WHERE my_str_field = "Milky Galaxy" AND my_int_field <> 90

8) All operator ".all()" (In development)

9) Any operator ".any()" (In development)

10) Between operator ".between()" (In development)

11) In operator "in"

In Epure: in -> In sql: IN

Example for in operator

@escript
def my_decorated_method():
    self.md.my_str_field in ("dog", "goes", "woof")
Will be in SQL:
SELECT * 
FROM public.my_epure_cls
WHERE my_str_field IN ("dog", "goes", "woof")

12) Like operator ".like()"

In Epure: .like() -> In sql: LIKE

Example for .like() operator

@escript
def my_decorated_method():
    self.md.my_str_field.like("%R")
Will be in SQL:
SELECT * 
FROM public.my_epure_cls
WHERE my_str_field LIKE "%R"

13) Or operator "or"

In Epure: or -> In sql: OR

Example for or operator

@escript
def my_decorated_method():
    self.md.my_str_field == "Milky Galaxy" or self.md.my_int_field != 90
Will be in SQL:
SELECT * 
FROM public.my_epure_cls
WHERE my_str_field = "Milky Galaxy" OR my_int_field <> 90

14) Some operator ".some()" (In development)

15) Is operator "is"

In Epure: is -> In sql: IS

Example for is operator

@escript
def my_decorated_method():
    self.md.my_str_field is None
Will be in SQL:
SELECT * 
FROM public.my_epure_cls
WHERE my_str_field IS NULL

15) Is not operator "is not"

In Epure: is not -> In sql: IS NOT

Example for is not operator

@escript
def my_decorated_method():
    self.md.my_str_field is not None
Will be in SQL:
SELECT * 
FROM public.my_epure_cls
WHERE my_str_field IS NOT NULL