Skip to content

Commit 30fe395

Browse files
Adding Vars trick (#429)
1 parent 01ee382 commit 30fe395

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

terminusdb_client/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from .client import GraphType, Patch, Client # noqa
22
from .woqldataframe import woqlDataframe as WOQLDataFrame # noqa
3-
from .woqlquery import WOQLQuery # noqa
3+
from .woqlquery import WOQLQuery, Var, Vars # noqa
44
from .woqlschema import * # noqa
55
# Backwards compatibility
66
WOQLClient = Client # noqa

terminusdb_client/query_syntax/query_syntax.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
from ..woqlquery import WOQLQuery, Var, Doc # noqa
1+
from ..woqlquery import WOQLQuery, Var, Vars, Doc # noqa
22
import re
33
import sys
44

55
__BARRED = ['re', 'vars']
66
__ALLOWED = ['__and__', '__or__', '__add__']
77
__module = sys.modules[__name__]
8-
__exported = ['Var', 'Doc']
8+
__exported = ['Var', 'Vars', 'Doc']
99

1010

1111
def __create_a_function(attribute):
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from .woql_query import WOQLQuery, Var, Doc # noqa
1+
from .woql_query import WOQLQuery, Var, Vars, Doc # noqa

terminusdb_client/woqlquery/woql_query.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ def to_dict(self):
5454
"variable": self.name}
5555

5656

57+
class Vars:
58+
def __init__(self, *args):
59+
for arg in args:
60+
setattr(self, arg, Var(arg))
61+
62+
5763
class Doc:
5864
def __init__(self, dictionary):
5965
self.dictionary = dictionary

0 commit comments

Comments
 (0)