Skip to content

Commit

Permalink
Adding Vars trick (#429)
Browse files Browse the repository at this point in the history
  • Loading branch information
GavinMendelGleason authored Feb 16, 2024
1 parent 01ee382 commit 30fe395
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion terminusdb_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .client import GraphType, Patch, Client # noqa
from .woqldataframe import woqlDataframe as WOQLDataFrame # noqa
from .woqlquery import WOQLQuery # noqa
from .woqlquery import WOQLQuery, Var, Vars # noqa
from .woqlschema import * # noqa
# Backwards compatibility
WOQLClient = Client # noqa
Expand Down
4 changes: 2 additions & 2 deletions terminusdb_client/query_syntax/query_syntax.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from ..woqlquery import WOQLQuery, Var, Doc # noqa
from ..woqlquery import WOQLQuery, Var, Vars, Doc # noqa
import re
import sys

__BARRED = ['re', 'vars']
__ALLOWED = ['__and__', '__or__', '__add__']
__module = sys.modules[__name__]
__exported = ['Var', 'Doc']
__exported = ['Var', 'Vars', 'Doc']


def __create_a_function(attribute):
Expand Down
2 changes: 1 addition & 1 deletion terminusdb_client/woqlquery/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .woql_query import WOQLQuery, Var, Doc # noqa
from .woql_query import WOQLQuery, Var, Vars, Doc # noqa
6 changes: 6 additions & 0 deletions terminusdb_client/woqlquery/woql_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ def to_dict(self):
"variable": self.name}


class Vars:
def __init__(self, *args):
for arg in args:
setattr(self, arg, Var(arg))


class Doc:
def __init__(self, dictionary):
self.dictionary = dictionary
Expand Down

0 comments on commit 30fe395

Please sign in to comment.