When set to true, act as if the opimization has been requested for every query. This is only intended for testing. Will be set to true if the environment variable PDB_QUERY_OPTIMIZE_DROP_UNUSED_JOINS is set to "always" at startup.
When set to true, act as if the opimization has been requested for every query. This is only intended for testing. Will be set to true if the environment variable PDB_QUERY_OPTIMIZE_DROP_UNUSED_JOINS is set to "always" at startup.
(annotate-with-context context)Add context as meta on each node that is a vector. This associates the
the query context assocated to each query clause with it's associated context
Add `context` as meta on each `node` that is a vector. This associates the the query context assocated to each query clause with it's associated context
(binary-expression? node)True if the plan node is a binary expression
True if the plan node is a binary expression
Query for the top level catalog-input-contents entity
Query for the top level catalog-input-contents entity
Query for the catalog-inputs entity
Query for the catalog-inputs entity
Query for the top level catalogs entity
Query for the top level catalogs entity
Column information: ["value" {:type :string :field fv.value_string ...}]
Column information: ["value" {:type :string :field fv.value_string ...}]
(compile-fnexpression expr)(compile-fnexpression {:keys [function column params]} alias?)(compile-query query-rec
user-query
{:keys [include_total explain] :as options}
target)Given a user provided query and a Query instance, converts the user provided query to the requested target. Current targets are either :parameterized-plan or :sql. For :sql, returns the SQL and extracted parameters, to be used in a prepared statement. For :parameterized-plan, returns the final plan and parameters that would be used to generate the :sql result.
Given a user provided query and a Query instance, converts the user provided query to the requested target. Current targets are either :parameterized-plan or :sql. For :sql, returns the SQL and extracted parameters, to be used in a prepared statement. For :parameterized-plan, returns the final plan and parameters that would be used to generate the :sql result.
(compile-user-query->sql query-rec user-query)(compile-user-query->sql query-rec user-query options)Given a user provided query and a Query instance, convert the user provided query to SQL and extract the parameters, to be used in a prepared statement.
Given a user provided query and a Query instance, convert the user provided query to SQL and extract the parameters, to be used in a prepared statement.
(convert-to-plan query-rec paging-options user-query)Converts the given user-query to a query plan that can later be converted into
a SQL statement
Converts the given `user-query` to a query plan that can later be converted into a SQL statement
(create-extract-node query-rec column expr)Inputs: [query-rec column expr] Returns: {(s/optional-key :projected-fields) [projection-schema], s/Any s/Any}
Inputs: [query-rec column expr]
Returns: {(s/optional-key :projected-fields) [projection-schema], s/Any s/Any}(create-extract-node* {:keys [projections] :as query-rec} column-list expr)Returns a query-rec that has the correct projection for the given
column-list. Updating :projected-fields causes the select in the SQL query
to be modified.
Returns a `query-rec` that has the correct projection for the given `column-list`. Updating :projected-fields causes the select in the SQL query to be modified.
(create-from-node entity expr clauses)Inputs: [entity expr clauses] Returns: {(s/optional-key :projected-fields) [projection-schema], s/Any s/Any}
Create an explicit subquery declaration to mimic the select_<entity> syntax.
Inputs: [entity expr clauses]
Returns: {(s/optional-key :projected-fields) [projection-schema], s/Any s/Any}
Create an explicit subquery declaration to mimic the select_<entity>
syntax.(create-json-path-extraction field path)Given a base json field and a path of keys to traverse, construct the proper SQL query of the form base->'key'->'key2'...
Given a base json field and a path of keys to traverse, construct the proper SQL query of the form base->'key'->'key2'...
(create-json-subtree-projection [top & path :as _parsed-field] projections)(create-paging-map clauses)Given a list of clauses [['limit'1 1] ['offset' 1], etc], convert to a map {:limit 1 :offset 1}
Given a list of clauses [['limit'1 1] ['offset' 1], etc], convert to a map
{:limit 1 :offset 1}When true, enable the opimization whenever a query doesn't set the optimize_drop_unused_joins parameter. This will be true if PDB_QUERY_OPTIMIZE_DROP_UNUSED_JOINS is unset or is set to "by-default" at startup, and will be false if it is set to "by-request".
When true, enable the opimization whenever a query doesn't set the optimize_drop_unused_joins parameter. This will be true if PDB_QUERY_OPTIMIZE_DROP_UNUSED_JOINS is unset or is set to "by-default" at startup, and will be false if it is set to "by-request".
Basic environments query, more useful when used with subqueries
Basic environments query, more useful when used with subqueries
(expand-query-node node)Expands/normalizes the user provided query to a minimal subset of the query language
Expands/normalizes the user provided query to a minimal subset of the query language
(expand-user-query user-query)Expands/translates the query from a user provided one to a
normalized query that only contains our lower-level operators.
Things like [node active] will be expanded into a full
subquery (via the in and extract operators)
Expands/translates the query from a user provided one to a normalized query that only contains our lower-level operators. Things like [node active] will be expanded into a full subquery (via the `in` and `extract` operators)
(extract-all-params plan)Zip through the query plan, replacing each user provided query parameter with '?' and return the parameters as a vector
Zip through the query plan, replacing each user provided query parameter with '?' and return the parameters as a vector
(extract-expression? expr)Returns true if expr is an extract expression
Returns true if expr is an extract expression
(extract-params node state)Extracts the node's expression value, puts it in state
replacing it with ?, used in a prepared statement
Extracts the node's expression value, puts it in state replacing it with `?`, used in a prepared statement
Query for the fact-paths query, mostly used as a subquery
Query for the fact-paths query, mostly used as a subquery
Query for the top level facts query
Query for the top level facts query
Query for factsets with the package_inventory reconstructed (used for sync)
Query for factsets with the package_inventory reconstructed (used for sync)
(fn-binary-expression->hsql op function args)Produce a predicate that compares the result of a function against a provided value. The operator, function name and its arguments must have already been validated.
Produce a predicate that compares the result of a function against a provided value. The operator, function name and its arguments must have already been validated.
(group-by-entries->fields query-rec entries)Convert a list of group by columns and functions to their true SQL field names.
Convert a list of group by columns and functions to their true SQL field names.
(group-by-entry->sql-field query-rec column-or-fn-name)Converts a column into its qualified SQL field name or a function expression into its function name. Throws a bad-query-ex if there is an invalid field or function
Converts a column into its qualified SQL field name or a function expression into its function name. Throws a bad-query-ex if there is an invalid field or function
(include-projection-dependencies proj-info projections)Returns projections after adding any dependencies of its memebers, i.e. any :depends listed in the query-rec proj-info for the projection.
Returns projections after adding any dependencies of its memebers, i.e. any :depends listed in the query-rec proj-info for the projection.
Usually used as a subquery of reports
Usually used as a subquery of reports
Usually used as a subquery of reports
Usually used as a subquery of reports
(map->ArrayBinaryExpression m34817)Factory function for class ArrayBinaryExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
Factory function for class ArrayBinaryExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
(map->ArrayRegexExpression m34711)Factory function for class ArrayRegexExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
Factory function for class ArrayRegexExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
(map->BinaryExpression m34545)Factory function for class BinaryExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
Factory function for class BinaryExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
(map->FnBinaryExpression m34478)Factory function for class FnBinaryExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
Factory function for class FnBinaryExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
(map->InArrayExpression m34605)Factory function for class InArrayExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
Factory function for class InArrayExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
(map->InExpression m35216)Factory function for class InExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
Factory function for class InExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
(map->JsonbPathBinaryExpression m35089)Factory function for class JsonbPathBinaryExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
Factory function for class JsonbPathBinaryExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
(map->JsonbScalarRegexExpression m35156)Factory function for class JsonbScalarRegexExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
Factory function for class JsonbScalarRegexExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
(map->JsonContainsExpression m35029)Factory function for class JsonContainsExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
Factory function for class JsonContainsExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
(map->NullExpression m34764)Factory function for class NullExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
Factory function for class NullExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
(map->PathArrayAnyMatch m34923)Factory function for class PathArrayAnyMatch, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
Factory function for class PathArrayAnyMatch, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
(map->PathArrayMatch m34870)Factory function for class PathArrayMatch, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
Factory function for class PathArrayMatch, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
(map->PathArrayRegexMatch m34976)Factory function for class PathArrayRegexMatch, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
Factory function for class PathArrayRegexMatch, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
(map->Query m34355)Factory function for class Query, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
Factory function for class Query, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
(map->RegexExpression m34658)Factory function for class RegexExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
Factory function for class RegexExpression, taking a map of keywords to field values, but not much slower than ->x like the clojure.core version. (performance is fixed in Clojure 1.7, so this should eventually be removed.)
(name-constraint user-query-clause)If the query clause is either a simple constraint on 'name' or a pure conjunction containing such a constraint, return the first fact name.
If the query clause is either a simple constraint on 'name' or a pure conjunction containing such a constraint, return the first fact name.
(no-type-restriction? expr)Determine whether an expression already contains a restriction of values to numbers.
Determine whether an expression already contains a restriction of values to numbers.
Query for nodes entities, mostly used currently for subqueries
Query for nodes entities, mostly used currently for subqueries
Query for nodes entities, mostly used currently for subqueries
Query for nodes entities, mostly used currently for subqueries
(numeric-fact-functions? clauses)Determine whether an extract clause contains numeric aggregate functions, implying that the query must be restricted for successful type coercion.
Determine whether an extract clause contains numeric aggregate functions, implying that the query must be restricted for successful type coercion.
(ops-to-lower node state)Lower cases operators (such as and/or).
Lower cases operators (such as and/or).
Packages and the machines they are installed on
Packages and the machines they are installed on
(parse-dot-query {:keys [field value] :as node} state)Transforms a dotted query into a JSON structure appropriate for comparison in the database.
Transforms a dotted query into a JSON structure appropriate for comparison in the database.
(parse-dot-query-with-array-elements {:keys [field value] :as node} state)Transforms a dotted query into a JSON structure appropriate for comparison in the database.
Transforms a dotted query into a JSON structure appropriate for comparison in the database.
(parse-query-context query warn)Parses a top-level query with a 'from', validates it and returns the entity and remaining-query in a map.
Parses a top-level query with a 'from', validates it and returns the entity and remaining-query in a map.
(plan->sql query options)Convert query to a SQL string
Convert `query` to a SQL string
Basic producers query, more useful when used with subqueries
Basic producers query, more useful when used with subqueries
(projectable-fields {:keys [projections]})Returns a list of projectable fields from a query record.
Fields marked as :unprojectable? true are unable to be projected and thus are excluded.
Returns a list of projectable fields from a query record. Fields marked as :unprojectable? true are unable to be projected and thus are excluded.
(projectable-json-fields {:keys [projections]})Returns a list of fields of queryable json fields that are marked that they support projectable json extraction.
Returns a list of fields of queryable json fields that are marked that they support projectable json extraction.
Named projection: ["value" {:type :string :field fv.value_string ...}]
Named projection: ["value" {:type :string :field fv.value_string ...}]
(push-down-context context user-query)Pushes the top level query context down to each query node, throws a bad-query-ex if any unrecognized fields appear in the query
Pushes the top level query context down to each query node, throws a bad-query-ex if any unrecognized fields appear in the query
(queryable-fields {:keys [projections]})Returns a list of queryable fields from a query record.
These are fields with the setting :queryable? set to true.
Returns a list of queryable fields from a query record. These are fields with the setting :queryable? set to true.
(remove-elided-nodes node)This step removes elided nodes (marked with ::elide by expand-user-query) from
and and or clauses.
This step removes elided nodes (marked with ::elide by expand-user-query) from `and` and `or` clauses.
Query for the top level reports entity
Query for the top level reports entity
Query intended to be used by the /reports/<hash>/logs endpoint
used for digging into the logs for a specific report.
Query intended to be used by the `/reports/<hash>/logs` endpoint used for digging into the logs for a specific report.
Query intended to be used by the /reports/<hash>/metrics endpoint
used for digging into the metrics for a specific report.
Query intended to be used by the `/reports/<hash>/metrics` endpoint used for digging into the metrics for a specific report.
Query for the resource-params query, mostly used as a subquery
Query for the resource-params query, mostly used as a subquery
Query for the top level resource entity
Query for the top level resource entity
(rewrite-fact-query query-rec user-query)Rewrite fact queries that constrain the fact name to directly extract the value using the json -> operator, by changing the :selection field of the query-rec.
Rewrite fact queries that constrain the fact name to directly extract the value using the json -> operator, by changing the :selection field of the query-rec.
A function that will return nil if the query snippet successfully validates, otherwise will return a data structure with error information
A function that will return nil if the query snippet successfully validates, otherwise will return a data structure with error information
(sql-select-for-query {:keys [projected-fields call selection projections]
:as _query})Returns the honesql representation of the query's select, i.e. {:select expr}.
Returns the honesql representation of the query's select,
i.e. {:select expr}.(-plan->sql query options)Given the query plan node, convert it to a SQL string
Given the `query` plan node, convert it to a SQL string
(strict-map->ArrayBinaryExpression m34818 & [drop-extra-keys?__3495__auto__])Factory function for class ArrayBinaryExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
Factory function for class ArrayBinaryExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
(strict-map->ArrayRegexExpression m34712 & [drop-extra-keys?__3495__auto__])Factory function for class ArrayRegexExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
Factory function for class ArrayRegexExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
(strict-map->BinaryExpression m34546 & [drop-extra-keys?__3495__auto__])Factory function for class BinaryExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
Factory function for class BinaryExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
(strict-map->FnBinaryExpression m34479 & [drop-extra-keys?__3495__auto__])Factory function for class FnBinaryExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
Factory function for class FnBinaryExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
(strict-map->InArrayExpression m34606 & [drop-extra-keys?__3495__auto__])Factory function for class InArrayExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
Factory function for class InArrayExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
(strict-map->InExpression m35217 & [drop-extra-keys?__3495__auto__])Factory function for class InExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
Factory function for class InExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
(strict-map->JsonbPathBinaryExpression m35090
&
[drop-extra-keys?__3495__auto__])Factory function for class JsonbPathBinaryExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
Factory function for class JsonbPathBinaryExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
(strict-map->JsonbScalarRegexExpression m35157
&
[drop-extra-keys?__3495__auto__])Factory function for class JsonbScalarRegexExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
Factory function for class JsonbScalarRegexExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
(strict-map->JsonContainsExpression m35030 & [drop-extra-keys?__3495__auto__])Factory function for class JsonContainsExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
Factory function for class JsonContainsExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
(strict-map->NullExpression m34765 & [drop-extra-keys?__3495__auto__])Factory function for class NullExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
Factory function for class NullExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
(strict-map->PathArrayAnyMatch m34924 & [drop-extra-keys?__3495__auto__])Factory function for class PathArrayAnyMatch, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
Factory function for class PathArrayAnyMatch, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
(strict-map->PathArrayMatch m34871 & [drop-extra-keys?__3495__auto__])Factory function for class PathArrayMatch, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
Factory function for class PathArrayMatch, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
(strict-map->PathArrayRegexMatch m34977 & [drop-extra-keys?__3495__auto__])Factory function for class PathArrayRegexMatch, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
Factory function for class PathArrayRegexMatch, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
(strict-map->Query m34356 & [drop-extra-keys?__3495__auto__])Factory function for class Query, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
Factory function for class Query, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
(strict-map->RegexExpression m34659 & [drop-extra-keys?__3495__auto__])Factory function for class RegexExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
Factory function for class RegexExpression, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
(subquery-expression? expr)Returns true if expr is a subquery expression
Returns true if expr is a subquery expression
(try-parse-timestamp ts)Try to convert a string to a timestamp, throwing an exception if it fails
Try to convert a string to a timestamp, throwing an exception if it fails
(user-node->plan-node query-rec node)Create a query plan for node in the context of the given query (as query-rec)
Create a query plan for `node` in the context of the given query (as `query-rec`)
(user-query->logical-obj subquery)Keypairs of the stringified subquery keyword (found in user defined queries) to the appropriate plan node
Keypairs of the stringified subquery keyword (found in user defined queries) to the appropriate plan node
(validate-binary-operators node)Validation of the user provided query
Validation of the user provided query
(validate-extract-filters expr)Validates the operators inside an extract clause. Short-circuits once an invalid operator is found
Validates the operators inside an extract clause. Short-circuits once an invalid operator is found
(validate-fn-binary-expr query-rec f args)Throws an exception if the args are not appropriate for the AST function named f.
Throws an exception if the args are not appropriate for the AST function named f.
(validate-query-fields node state)Add an error message to state if the field is not available for querying
by the associated query-context
Add an error message to `state` if the field is not available for querying by the associated query-context
(validate-query-operation-fields field
allowed-fields
allowed-json-extracts
query-name
error-action
error-context)Checks if query operation contains allowed fields. Returns error message string if some of the fields are invalid.
Error-action and error-context parameters help in formatting different error messages.
Checks if query operation contains allowed fields. Returns error message string if some of the fields are invalid. Error-action and error-context parameters help in formatting different error messages.
(vec? x)Same as set?/list?/map? but for vectors
Same as set?/list?/map? but for vectors
(warn-experimental entity)Show a warning if the endpoint is experimental.
Show a warning if the endpoint is experimental.
(wrap-with-node-state-cte selection node-purge-ttl)Wrap a selection in a CTE representing expired or deactivated certnames
Wrap a selection in a CTE representing expired or deactivated certnames
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |