Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

In TQL, a query is any operations on the model instance data (or model data), which includes filtering, joining, and manipulations. Model instances are incarnations of the Models (or model definitions) through instantiation. The TQLEngine stores the latest version of the model instance data, which is accessible to TQL Queries. See data storage for more details.

There is a special type of query which allows you to show or list the model definitions themselves. See /wiki/spaces/TQLDocs/pages/1179668 for details.

Like conventional queries, TQL queries perform CRUD operations on data. but unlike conventional database queries, TQL queries are:

(1) Current. The TQLEngine maintains the latest versions of any attribute values and attribute known values. TQL queries always return those latest versions.

(2) Model-driven. Since the model definitions define the structure of the model data, the TQLEngine constructs the database queries based on the model definition to retrieve requested data or perform other CRUD operations. The model definition is NOT data schema. Model instance data are saved in schemaless key value pairs.

(3) Actionable. Modifications of model data via TQL queries, if involving actionable attributes, can result in activation of actions, some of which may execute device actuations.

TQL queries have the following standard structures:

FIND

CREATE

SAVE

UPDATE

DELETE

DELETEALL

When a project is deployed onto a TQL Engine, it always creates two end points

Queries are sent to end points as payload of a message.

What about the Query End Points?

 

When to use queries, what are the different ways

(1) from the app (client to TQLEngine) - external (needs query end point),  - return will be sent as message back to client.

(2) from model facet, invoke - internal (the return will be the output of the invoke). - query itself become part of the model action.

 

What can go inside a query

Save, update, delete, deleteAll, Find. Create, SetResponseData, For

Find can have constraints

FacetScript, JavaScript

Macro

 

Does query only change value, not known value (true)

 

What is the common structure of a query

 

What are the most commonly used types of queries

Instantiation query (create), or save 

Subscription query (save)

Find query, joint query

Update (update, save)

Macro

Show query

 

  • No labels