Run a WOQL Query with the Python Client

Assuming you have installed the client, connected to a database, and connected with a client, you can then query with WOQL.

WOQLQuery

Writing WOQL queries in Python is fairly simple. We have a WOQLQuery class that can be used to construct WOQL Queries.

A simple example, in which we get all the names of the people in the database:

from terminusdb_client import WOQLQuery, WOQLClient
query = WOQLQuery().woql_and(
    WOQLQuery().triple('v:PersonId', 'rdf:type', '@schema:Person'),
    WOQLQuery().trople('v:PersonId', '@schema:name', 'v:Name')
)
result = client.query(query)

For more information about WOQL query, read our WOQL query how-to guides.