Skip to content

Query

Bases: Component

Defining and Using Class Queries

Query Name(Arguments...) as %SQLQuery [ Keywords ]
{
    Implementation
}

arguments = field(default_factory=list)

List of MethodArgument

Usage example
query.arguments = [
    MethodArgument(
        "foo",
        type="%String",
        value=""
    ),
    MethodArgument(
        "bar",
        type="%Integer",
        value=1
    ),
]

impl = field(default_factory=list)

Query implementation

Can be a simple string for already indented and newline delimited code, or for use with CodeMode = expression or a list of strings for multiline code, in which case will be indented automatically by the generator.

Note

SQL query generation and syntax validation is not supported by this library.

keywords = field(default_factory=(lambda: {'SqlProc': None}), kw_only=True)

Query Syntax and Keywords

Optional dict used to specify keywords for this component.

SqlProc is enabled by default for Queries

Use {"Keyword": None} for keywords that do not have a value

Valid Query keywords
  • ClientName – An alias used by client projections of this query.
  • Final – Specifies whether this query is final (cannot be overridden in subclasses).
  • Internal – Specifies whether this query definition is internal (not displayed in the class documentation).
  • Private – Specifies whether the query is private.
  • Requires – Specifies a list of privileges a user or process must have to call this query.
  • SoapBindingStyle – Specifies the binding style or SOAP invocation mechanism used by this query, when it is used as a web method. Applies only in a class that is defined as a web service or web client.
  • SoapBodyUse – Specifies the encoding used by the inputs and outputs of this query, when it is used as a web method. Applies only in a class that is defined as a web service or web client.
  • SoapNameSpace – Specifies the namespace at the binding operation level in the WSDL for this query. Applies only in a class that is defined as a web service or web client.
  • SqlName – Overrides the default name of the projected SQL stored procedure. Applies only if this query is projected as an SQL stored procedure.
  • SqlProc – Specifies whether the query can be invoked as an SQL stored procedure.
  • SqlView – Specifies whether to project this query as an SQL view.
  • SqlViewName – Overrides the default name of the projected SQL view. Applies only if this query is projected as an SQL view.
  • WebMethod – Specifies whether this query is a web method. Applies only in a class that is defined as a web service or web client.

return_type = '%SQLQuery'

Class name used as return type

Should be %SQLQuery in most cases