Transpilers > SQL

The logic in this module builds a portion of a WHERE SQL clause based on a SCIM filter.

class scim2_filter_parser.transpilers.sql.AttrPath(attr_name, sub_attr, uri)
attr_name

Alias for field number 0

sub_attr

Alias for field number 1

uri

Alias for field number 2

class scim2_filter_parser.transpilers.sql.Transpiler(attr_map, *args, **kwargs)

Transpile a SCIM AST into a SQL WHERE clause (not including the “WHERE” keyword)

visit_PartialAttrExpr(node)

Dissect rather complex queries like the following:

emails[type eq "Primary"].value eq "001750ca-8202-47cd-b553-c63f4f245940"

First we restructure to something like this:

emails.value[type eq "Primary"] eq "001750ca-8202-47cd-b553-c63f4f245940"

Then we get SQL like this ‘emails.type = {0}’ and ‘emails.value’.

We need to take these two snippets and AND them together.

scim2_filter_parser.transpilers.sql.main(argv=None)

Main program. Used for testing.