Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Vars trick #429

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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 @@ -50,6 +50,12 @@ def __str__(self):
return 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
Loading