Exemple #1
0
def test_vqlquery_tokens_property_returns_only_tokens(path_to_query):
    vqlquery = VqlQuery(path_to_query, foo="bar", baz="lol")

    print(vqlquery.tokens)

    assert vqlquery.tokens == {"foo": "bar", "baz": "lol"}
Exemple #2
0
def test_vqlquery_tokens_property_immutable(path_to_query):
    vqlquery = VqlQuery(path_to_query)

    with pytest.raises(AttributeError):
        vqlquery.tokens = {"foo": "bar"}
Exemple #3
0
def test_vqlquery_attributes_can_be_set_directly(path_to_query):
    vqlquery = VqlQuery(path_to_query)

    vqlquery.dateupdated = "2020-01-01"

    assert str(vqlquery).endswith(r"WHERE updated > '2020-01-01'")
Exemple #4
0
def test_vqlquery_replaces_tokens_correctly(path_to_query):
    vqlquery = VqlQuery(path_to_query, dateupdated="2021-03-23")

    assert str(vqlquery).endswith(r"WHERE updated > '2021-03-23'")
Exemple #5
0
def test_vqlquery_fails_if_missing_tokens(path_to_query):
    vqlquery = VqlQuery(path_to_query)

    with pytest.raises(ValueError):
        str(vqlquery)
Exemple #6
0
def test_vqlquery_constructor_sets_attributes(path_to_query):
    vqlquery = VqlQuery(path_to_query, nils="gunnar")
    assert hasattr(vqlquery, "nils")
from pathlib import Path

from denodoclient.dataframes import DenodoDataFrameClient
from denodoclient import VqlQuery

if __name__ == "__main__":
    client = DenodoDataFrameClient("ddp")

    vqlquery = VqlQuery(Path("examples/template.sql"))

    df = client.query(vqlquery).to_dataframe()

    print(f"got {df.shape[0]} records!")