Function parameters and data-source identity
Choose the function surface deliberately
Use function metadata when designing what callers supply to a connector: server names, database names, query text, or optional settings. This is distinct from schema enforcement, which concerns returned data. A well-documented parameter still needs an implementation and an exported binding; a metadata record by itself does not prove that users can invoke it.34
SingleStore defines several function types and attaches them to different shared functions using Value.ReplaceType. SingleStoreODBC.Contents uses the main type, DataSource and the compatibility alias Database use the SSL-aware type, and Query uses the custom-SQL type. Compare these bindings before changing a label or assuming a type declaration is the active public surface.3
Compare two designs
In SingleStoreConnectorMeta, the required server and database parameters carry localized captions, descriptions, and sample values. The optional logical UseSSL parameter declares Documentation.AllowedValues = {true, false}. SingleStoreConnectorImpl forwards that value in the options record sent to GetODBCDataSource; the UI metadata is not the only place the option must be maintained.15
Bloomberg's EntryPointType has a single text parameter, marks it DataSource.Path = false, and adds multiline/code formatting metadata. Both Bloomberg.Query and the older BQL.Query receive that type. They use separate data-source kinds; sharing a type does not establish shared credential identity. The required query parameter is explicitly excluded from path calculation.24
Microsoft documents the host's path rules in Handling data source paths and Handling data access. Consult those rules before deciding which inputs should distinguish credential locations. The archived declarations show the chosen flags; they do not test credential reuse across machines or hosts.
Practical adaptation checks
- Keep parameter order and types aligned between the type value, implementation, and every public alias. SingleStore's SSL variant has a different third parameter from the main and custom-query variants.13
- Treat sample values as examples, not as implementation defaults. Follow the actual consumer to find null handling and fallback values.15
- Check resource keys before copying localized captions. The source retains
Extension.LoadStringcalls, while this archive strips packaged resource files; it cannot establish the rendered dialog text from those calls alone.1 - Decide which values describe a location and which describe a query within that location. Review Bloomberg's explicit exclusion as a design choice, rather than copying it to a server or tenant argument without checking the intended identity boundary.2
- Validate actual inputs in the implementation. A field caption, code-formatting hint, or allowed-values declaration is not evidence that the full driver/request path handles every malformed input.15
SingleStore's omitted or null UseSSL falls back to the credential's EncryptConnection field, defaulting to true unless that field is false. Its TestConnection returns the compatibility alias with server and database only, so that path does not exercise an explicit UseSSL argument. Test those entry points separately.68
Bloomberg also implements input guards: it rejects null and text that becomes empty after Text.Clean. That is separate from its editor metadata and is not a whitespace-trimming check. For adaptations, test omitted arguments, explicit null, blank query text, and compatibility aliases against the actual consumers.7
Examples
A typed server/database function with an optional setting
This complete type value is attached to SingleStore's exported SSL-aware functions. Its resource strings and ODBC consumer are dependencies outside the excerpt.13
SingleStoreODBC/SingleStoreODBC.m · lines 99–118 Open original source ↗
SingleStoreConnectorMeta = type function (
ServerAddr as ( type text meta [
Documentation.FieldCaption = Extension.LoadString("ServerFieldCaption"),
Documentation.FieldDescription = Extension.LoadString("ServerFieldDescription"),
Documentation.SampleValues = {Extension.LoadString("ServerFieldSample")}
]),
Database as ( type text meta [
Documentation.FieldCaption = Extension.LoadString("DBFieldCaption"),
Documentation.FieldDescription = Extension.LoadString("DBFieldsDescription"),
Documentation.SampleValues = {Extension.LoadString("DBFieldSample")}
]),
optional UseSSL as (type logical meta [
Documentation.FieldCaption = Extension.LoadString("UseSSLFieldCaption"),
Documentation.FieldDescription = Extension.LoadString("UseSSLFieldDescription"),
Documentation.AllowedValues = {true, false}
])
) as table meta [
Documentation.Name = Extension.LoadString("SSObjectName"),
Documentation.LongDescription = Extension.LoadString("SSObjectLongDescription")
];
Query text excluded from the data-source path
Bloomberg's complete type value pairs a path exclusion with editor formatting. Follow its shared bindings before deciding how to adapt the identity policy.24
Bloomberg/Bloomberg.m · lines 63–77 Open original source ↗
EntryPointType = type function (
Bloomberg as (type text meta [
DataSource.Path = false,
Documentation.FieldCaption = Extension.LoadString("Bql.Query.Dialog.Argument.Caption"),
Documentation.SampleValues = { Extension.LoadString("Bloomberg.Query.SampleValue") },
Formatting.IsMultiLine = true,
Formatting.IsCode = true
])
)
as table meta [
Documentation.Name = Extension.LoadString("Bql.Query.Dialog.Title") & " v" & ConnectorVersion,
Documentation.Description = Extension.LoadString("Bql.Function.Description")
];
See credential access, resources and module loading, and navigation.
-
SingleStore SSL-aware parameter type and documentation metadata. ↩↩↩↩↩↩
-
Bloomberg query parameter type, formatting, and path exclusion. ↩↩↩
-
SingleStore implementation forwards UseSSL to its ODBC options. ↩↩↩
-
SingleStore SSL selection from explicit options and the credential encryption setting. ↩
-
Bloomberg EntryPointImpl query guards before GetData. ↩
-
SingleStore TestConnection invokes the Database alias with two arguments. ↩