Description Usage Arguments Details Value Author(s) See Also Examples
The Query class is used to generate SQL queries for Causata. The queries are built with the helper
objects WithVariables
, Where
and Limit
.
SQL is generated when as.character()
is invoked on the query object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
this |
A query object. |
value |
For |
... |
For |
The Query object builds a query for customer data, a blank Query corresponds to
SELECT * FROM Customers variable
This query can be made more specific by adding variables with WithVariables
, adding where
clauses with Where
or setting a row limit with Limit
.
The actual SQL query can be generated with as.character, e.g. as.character(Query())
.
The variables and limit can be retrieved and modified with Variables(query)
and Limit(query)
respectively.
Query
returns a blank Query object.
David Barker, Justin Hemann (support@causata.com)
FocalPointQuery
,
Connect
,
Variables
,
Where
,
CausataData
,
is
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | q <- Query()
q <- q + WithVariables(c("var1", "var2"))
q <- q + Where("variable-one", GreaterThan(30))
Variables(q) # returns c("var1", "var2")
Variables(q) <- c("var2", "var3") # set the variables for this query
Limit(q) # since the limit has not been set this returns NULL
Limit(q) <- 1000 # Sets the limit to 1000
as.character(q)
q <- Query() + WithVariables("variable-one", "variable-two") +
Where("variable-one", GreaterThan(5))
# The example below is commented out since it requires a server connection.
# With a connection this would retrieve data and return it in a dataframe df.
## Not run:
conn <- Connect(hostname, port, username, password)
data <- GetData(conn, q)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.