Kirill Simonov avatar Kirill Simonov committed c3f8354

Added `.filter()` and `.select()` functions as aliases to `?` and `{}` operators.

Comments (0)

Files changed (8)

src/htsql/tr/fn/bind.py

                        IntegerDomain, DecimalDomain, FloatDomain,
                        DateDomain, TimeDomain, DateTimeDomain, EnumDomain)
 from ..syntax import (NumberSyntax, StringSyntax, IdentifierSyntax,
-                      SpecifierSyntax, FunctionSyntax)
+                      SpecifierSyntax, FunctionSyntax, GroupSyntax)
 from ..binding import (LiteralBinding, SortBinding, SieveBinding,
                        FormulaBinding, CastBinding, WrapperBinding,
                        TitleBinding, DirectionBinding, QuotientBinding,
 from ..bind import BindByName, BindByRecipe, BindingState
 from ..error import BindError
 from ..coerce import coerce
-from ..lookup import lookup_attribute, lookup_complement, expand
+from ..lookup import lookup_attribute, lookup_complement, direct, expand
 from ..signature import (Signature, NullarySig, UnarySig, BinarySig,
                          CompareSig, IsEqualSig, IsTotallyEqualSig, IsInSig,
                          IsNullSig, IfNullSig, NullIfSig, AndSig, OrSig,
                         ContainsSig, ExistsSig, CountSig, MinMaxSig,
                         SumSig, AvgSig, AggregateSig, QuantifySig,
                         QuotientSig, KernelSig, ComplementSig,
-                        AssignmentSig, DefineSig, WhereSig)
+                        AssignmentSig, DefineSig, WhereSig, SelectSig)
 import sys
 
 
         return SieveBinding(base, filter, self.syntax)
 
 
+class BindFilter(BindMacro):
+
+    named('filter')
+    signature = UnarySig
+
+    def expand(self, op):
+        filter = self.state.bind(op)
+        filter = CastBinding(filter, coerce(BooleanDomain()), filter.syntax)
+        return SieveBinding(self.state.base, filter, self.syntax)
+
+
+class BindSelect(BindMacro):
+
+    named('select')
+    signature = SelectSig
+
+    def expand(self, ops):
+        elements = []
+        for op in ops:
+            element = self.state.bind(op)
+            recipies = expand(element)
+            if recipies is not None:
+                for syntax, recipe in recipies:
+                    if not isinstance(syntax, (IdentifierSyntax, GroupSyntax)):
+                        syntax = GroupSyntax(syntax, syntax.mark)
+                    syntax = SpecifierSyntax('.', element.syntax, syntax,
+                                             syntax.mark)
+                    bind = BindByRecipe(recipe, syntax, self.state)
+                    elements.append(bind())
+            else:
+                elements.append(element)
+        order = []
+        for element in elements:
+            direction = direct(element)
+            if direction is not None:
+                order.append(element)
+        base = self.state.base
+        if order:
+            base = SortBinding(base, order, None, None, base.syntax)
+        return SelectionBinding(base, elements, base.syntax)
+
+
+
 class BindDirectionBase(BindMacro):
 
     signature = SortDirectionSig

src/htsql/tr/fn/signature.py

     ]
 
 
+class SelectSig(Signature):
+
+    slots = [
+            Slot('ops', is_mandatory=False, is_singular=False),
+    ]
+
+
 class CastSig(Signature):
 
     slots = [

test/regress/input/translation.yaml

     - uri: /semester?season='fall'
     # Using the same term for a filter and a selector
     - uri: /program{school.name,title}?school.code='art'
+    # Functional syntax
+    - uri: /school.filter(code='ns')
+    - uri: /department.filter(school.code={'art','la'})
 
   # Simple (non-aggregate) selectors.
   - title: Simple selectors
       skip: true
     - uri: /school{}
       skip: true
+    # Functional syntax
+    - uri: /school.select(name)
+    - uri: /department.select(school.*, *)
 
   # Plural links and aggregates.
   - title: Aggregates

test/regress/output/mssql.yaml

                                ON ([program].[school] = [school].[code])
                WHERE ([school].[code] = 'art')
                ORDER BY [program].[school] ASC, [program].[code] ASC
+          - uri: /school.filter(code='ns')
+            status: 200 OK
+            headers:
+            - [Content-Type, text/plain; charset=UTF-8]
+            body: |2
+               | school                            |
+              -+-----------------------------------+-
+               | code | name                       |
+              -+------+----------------------------+-
+               | ns   | School of Natural Sciences |
+                                             (1 row)
+
+               ----
+               /school.filter(code='ns')
+               SELECT [school].[code],
+                      [school].[name]
+               FROM [ad].[school] AS [school]
+               WHERE ([school].[code] = 'ns')
+               ORDER BY 1 ASC
+          - uri: /department.filter(school.code={'art','la'})
+            status: 200 OK
+            headers:
+            - [Content-Type, text/plain; charset=UTF-8]
+            body: |2
+               | department                          |
+              -+-------------------------------------+-
+               | code   | name              | school |
+              -+--------+-------------------+--------+-
+               | arthis | Art History       | art    |
+               | eng    | English           | la     |
+               | hist   | History           | la     |
+               | lang   | Foreign Languages | la     |
+               | poli   | Political Science | la     |
+               | psych  | Psychology        | la     |
+               | stdart | Studio Art        | art    |
+                                              (7 rows)
+
+               ----
+               /department.filter(school.code={'art','la'})
+               SELECT [department].[code],
+                      [department].[name],
+                      [department].[school]
+               FROM [ad].[department] AS [department]
+                    LEFT OUTER JOIN [ad].[school] AS [school]
+                                    ON ([department].[school] = [school].[code])
+               WHERE ([school].[code] IN ('art', 'la'))
+               ORDER BY 1 ASC
         - id: simple-selectors
           tests:
           - uri: /school{name}
                     LEFT OUTER JOIN [ad].[school] AS [school]
                                     ON ([department].[school] = [school].[code])
                ORDER BY [department].[code] ASC
+          - uri: /school.select(name)
+            status: 200 OK
+            headers:
+            - [Content-Type, text/plain; charset=UTF-8]
+            body: |2
+               | school                        |
+              -+-------------------------------+-
+               | name                          |
+              -+-------------------------------+-
+               | School of Art and Design      |
+               | School of Business            |
+               | College of Education          |
+               | School of Engineering         |
+               | School of Arts and Humanities |
+               | School of Music & Dance       |
+               | School of Natural Sciences    |
+               | Public Honorariums            |
+               | School of Continuing Studies  |
+                                        (9 rows)
+
+               ----
+               /school.select(name)
+               SELECT [school].[name]
+               FROM [ad].[school] AS [school]
+               ORDER BY [school].[code] ASC
+          - uri: /department.select(school.*, *)
+            status: 200 OK
+            headers:
+            - [Content-Type, text/plain; charset=UTF-8]
+            body: |2
+               | department                                                                      |
+              -+---------------------------------------------------------------------------------+-
+               | code | name                          | code   | name                   | school |
+              -+------+-------------------------------+--------+------------------------+--------+-
+               | bus  | School of Business            | acc    | Accounting             | bus    |
+               | art  | School of Art and Design      | arthis | Art History            | art    |
+               | ns   | School of Natural Sciences    | astro  | Astronomy              | ns     |
+               | eng  | School of Engineering         | be     | Bioengineering         | eng    |
+               |      |                               | bursar | Bursar's Office        |        |
+               | bus  | School of Business            | capmrk | Capital Markets        | bus    |
+               |      |                               | career | Career Development     |        |
+               | ns   | School of Natural Sciences    | chem   | Chemistry              | ns     |
+               | eng  | School of Engineering         | comp   | Computer Science       | eng    |
+               | bus  | School of Business            | corpfi | Corporate Finance      | bus    |
+               | edu  | College of Education          | edpol  | Educational Policy     | edu    |
+               | eng  | School of Engineering         | ee     | Electrical Engineering | eng    |
+               | la   | School of Arts and Humanities | eng    | English                | la     |
+               | la   | School of Arts and Humanities | hist   | History                | la     |
+               | la   | School of Arts and Humanities | lang   | Foreign Languages      | la     |
+               | eng  | School of Engineering         | me     | Mechanical Engineering | eng    |
+               | ns   | School of Natural Sciences    | mth    | Mathematics            | ns     |
+               |      |                               | parent | Parents & Alumni       |        |
+               | ns   | School of Natural Sciences    | phys   | Physics                | ns     |
+               | mus  | School of Music & Dance       | pia    | Piano                  | mus    |
+               | la   | School of Arts and Humanities | poli   | Political Science      | la     |
+               | la   | School of Arts and Humanities | psych  | Psychology             | la     |
+               | art  | School of Art and Design      | stdart | Studio Art             | art    |
+               | mus  | School of Music & Dance       | str    | Strings                | mus    |
+               | edu  | College of Education          | tched  | Teacher Education      | edu    |
+               | mus  | School of Music & Dance       | voc    | Vocals                 | mus    |
+               | mus  | School of Music & Dance       | win    | Wind                   | mus    |
+                                                                                         (27 rows)
+
+               ----
+               /department.select(school.*,*)
+               SELECT [school].[code],
+                      [school].[name],
+                      [department].[code],
+                      [department].[name],
+                      [department].[school]
+               FROM [ad].[department] AS [department]
+                    LEFT OUTER JOIN [ad].[school] AS [school]
+                                    ON ([department].[school] = [school].[code])
+               ORDER BY 3 ASC
         - id: aggregates
           tests:
           - uri: /exists(school)

test/regress/output/mysql.yaml

                                ON (`program`.`school` = `school`.`code`)
                WHERE (`school`.`code` = 'art')
                ORDER BY `program`.`school` ASC, `program`.`code` ASC
+          - uri: /school.filter(code='ns')
+            status: 200 OK
+            headers:
+            - [Content-Type, text/plain; charset=UTF-8]
+            body: |2
+               | school                            |
+              -+-----------------------------------+-
+               | code | name                       |
+              -+------+----------------------------+-
+               | ns   | School of Natural Sciences |
+                                             (1 row)
+
+               ----
+               /school.filter(code='ns')
+               SELECT `school`.`code`,
+                      `school`.`name`
+               FROM `htsql_regress`.`school` AS `school`
+               WHERE (`school`.`code` = 'ns')
+               ORDER BY 1 ASC
+          - uri: /department.filter(school.code={'art','la'})
+            status: 200 OK
+            headers:
+            - [Content-Type, text/plain; charset=UTF-8]
+            body: |2
+               | department                          |
+              -+-------------------------------------+-
+               | code   | name              | school |
+              -+--------+-------------------+--------+-
+               | arthis | Art History       | art    |
+               | eng    | English           | la     |
+               | hist   | History           | la     |
+               | lang   | Foreign Languages | la     |
+               | poli   | Political Science | la     |
+               | psych  | Psychology        | la     |
+               | stdart | Studio Art        | art    |
+                                              (7 rows)
+
+               ----
+               /department.filter(school.code={'art','la'})
+               SELECT `department`.`code`,
+                      `department`.`name`,
+                      `department`.`school`
+               FROM `htsql_regress`.`department` AS `department`
+                    LEFT OUTER JOIN `htsql_regress`.`school` AS `school`
+                                    ON (`department`.`school` = `school`.`code`)
+               WHERE (`school`.`code` IN ('art', 'la'))
+               ORDER BY 1 ASC
         - id: simple-selectors
           tests:
           - uri: /school{name}
                     LEFT OUTER JOIN `htsql_regress`.`school` AS `school`
                                     ON (`department`.`school` = `school`.`code`)
                ORDER BY `department`.`code` ASC
+          - uri: /school.select(name)
+            status: 200 OK
+            headers:
+            - [Content-Type, text/plain; charset=UTF-8]
+            body: |2
+               | school                        |
+              -+-------------------------------+-
+               | name                          |
+              -+-------------------------------+-
+               | School of Art and Design      |
+               | School of Business            |
+               | College of Education          |
+               | School of Engineering         |
+               | School of Arts and Humanities |
+               | School of Music & Dance       |
+               | School of Natural Sciences    |
+               | Public Honorariums            |
+               | School of Continuing Studies  |
+                                        (9 rows)
+
+               ----
+               /school.select(name)
+               SELECT `school`.`name`
+               FROM `htsql_regress`.`school` AS `school`
+               ORDER BY `school`.`code` ASC
+          - uri: /department.select(school.*, *)
+            status: 200 OK
+            headers:
+            - [Content-Type, text/plain; charset=UTF-8]
+            body: |2
+               | department                                                                      |
+              -+---------------------------------------------------------------------------------+-
+               | code | name                          | code   | name                   | school |
+              -+------+-------------------------------+--------+------------------------+--------+-
+               | bus  | School of Business            | acc    | Accounting             | bus    |
+               | art  | School of Art and Design      | arthis | Art History            | art    |
+               | ns   | School of Natural Sciences    | astro  | Astronomy              | ns     |
+               | eng  | School of Engineering         | be     | Bioengineering         | eng    |
+               |      |                               | bursar | Bursar's Office        |        |
+               | bus  | School of Business            | capmrk | Capital Markets        | bus    |
+               |      |                               | career | Career Development     |        |
+               | ns   | School of Natural Sciences    | chem   | Chemistry              | ns     |
+               | eng  | School of Engineering         | comp   | Computer Science       | eng    |
+               | bus  | School of Business            | corpfi | Corporate Finance      | bus    |
+               | edu  | College of Education          | edpol  | Educational Policy     | edu    |
+               | eng  | School of Engineering         | ee     | Electrical Engineering | eng    |
+               | la   | School of Arts and Humanities | eng    | English                | la     |
+               | la   | School of Arts and Humanities | hist   | History                | la     |
+               | la   | School of Arts and Humanities | lang   | Foreign Languages      | la     |
+               | eng  | School of Engineering         | me     | Mechanical Engineering | eng    |
+               | ns   | School of Natural Sciences    | mth    | Mathematics            | ns     |
+               |      |                               | parent | Parents & Alumni       |        |
+               | ns   | School of Natural Sciences    | phys   | Physics                | ns     |
+               | mus  | School of Music & Dance       | pia    | Piano                  | mus    |
+               | la   | School of Arts and Humanities | poli   | Political Science      | la     |
+               | la   | School of Arts and Humanities | psych  | Psychology             | la     |
+               | art  | School of Art and Design      | stdart | Studio Art             | art    |
+               | mus  | School of Music & Dance       | str    | Strings                | mus    |
+               | edu  | College of Education          | tched  | Teacher Education      | edu    |
+               | mus  | School of Music & Dance       | voc    | Vocals                 | mus    |
+               | mus  | School of Music & Dance       | win    | Wind                   | mus    |
+                                                                                         (27 rows)
+
+               ----
+               /department.select(school.*,*)
+               SELECT `school`.`code`,
+                      `school`.`name`,
+                      `department`.`code`,
+                      `department`.`name`,
+                      `department`.`school`
+               FROM `htsql_regress`.`department` AS `department`
+                    LEFT OUTER JOIN `htsql_regress`.`school` AS `school`
+                                    ON (`department`.`school` = `school`.`code`)
+               ORDER BY 3 ASC
         - id: aggregates
           tests:
           - uri: /exists(school)

test/regress/output/oracle.yaml

                                ON ("PROGRAM"."SCHOOL" = "SCHOOL"."CODE")
                WHERE ("SCHOOL"."CODE" = 'art')
                ORDER BY "PROGRAM"."SCHOOL" ASC, "PROGRAM"."CODE" ASC
+          - uri: /school.filter(code='ns')
+            status: 200 OK
+            headers:
+            - [Content-Type, text/plain; charset=UTF-8]
+            body: |2
+               | school                            |
+              -+-----------------------------------+-
+               | code | name                       |
+              -+------+----------------------------+-
+               | ns   | School of Natural Sciences |
+                                             (1 row)
+
+               ----
+               /school.filter(code='ns')
+               SELECT "SCHOOL"."CODE",
+                      "SCHOOL"."NAME"
+               FROM "HTSQL_REGRESS"."SCHOOL" "SCHOOL"
+               WHERE ("SCHOOL"."CODE" = 'ns')
+               ORDER BY 1 ASC
+          - uri: /department.filter(school.code={'art','la'})
+            status: 200 OK
+            headers:
+            - [Content-Type, text/plain; charset=UTF-8]
+            body: |2
+               | department                          |
+              -+-------------------------------------+-
+               | code   | name              | school |
+              -+--------+-------------------+--------+-
+               | arthis | Art History       | art    |
+               | eng    | English           | la     |
+               | hist   | History           | la     |
+               | lang   | Foreign Languages | la     |
+               | poli   | Political Science | la     |
+               | psych  | Psychology        | la     |
+               | stdart | Studio Art        | art    |
+                                              (7 rows)
+
+               ----
+               /department.filter(school.code={'art','la'})
+               SELECT "DEPARTMENT"."CODE",
+                      "DEPARTMENT"."NAME",
+                      "DEPARTMENT"."SCHOOL"
+               FROM "HTSQL_REGRESS"."DEPARTMENT" "DEPARTMENT"
+                    LEFT OUTER JOIN "HTSQL_REGRESS"."SCHOOL" "SCHOOL"
+                                    ON ("DEPARTMENT"."SCHOOL" = "SCHOOL"."CODE")
+               WHERE ("SCHOOL"."CODE" IN ('art', 'la'))
+               ORDER BY 1 ASC
         - id: simple-selectors
           tests:
           - uri: /school{name}
                     LEFT OUTER JOIN "HTSQL_REGRESS"."SCHOOL" "SCHOOL"
                                     ON ("DEPARTMENT"."SCHOOL" = "SCHOOL"."CODE")
                ORDER BY "DEPARTMENT"."CODE" ASC
+          - uri: /school.select(name)
+            status: 200 OK
+            headers:
+            - [Content-Type, text/plain; charset=UTF-8]
+            body: |2
+               | school                        |
+              -+-------------------------------+-
+               | name                          |
+              -+-------------------------------+-
+               | School of Art and Design      |
+               | School of Business            |
+               | College of Education          |
+               | School of Engineering         |
+               | School of Arts and Humanities |
+               | School of Music & Dance       |
+               | School of Natural Sciences    |
+               | Public Honorariums            |
+               | School of Continuing Studies  |
+                                        (9 rows)
+
+               ----
+               /school.select(name)
+               SELECT "SCHOOL"."NAME"
+               FROM "HTSQL_REGRESS"."SCHOOL" "SCHOOL"
+               ORDER BY "SCHOOL"."CODE" ASC
+          - uri: /department.select(school.*, *)
+            status: 200 OK
+            headers:
+            - [Content-Type, text/plain; charset=UTF-8]
+            body: |2
+               | department                                                                      |
+              -+---------------------------------------------------------------------------------+-
+               | code | name                          | code   | name                   | school |
+              -+------+-------------------------------+--------+------------------------+--------+-
+               | bus  | School of Business            | acc    | Accounting             | bus    |
+               | art  | School of Art and Design      | arthis | Art History            | art    |
+               | ns   | School of Natural Sciences    | astro  | Astronomy              | ns     |
+               | eng  | School of Engineering         | be     | Bioengineering         | eng    |
+               |      |                               | bursar | Bursar's Office        |        |
+               | bus  | School of Business            | capmrk | Capital Markets        | bus    |
+               |      |                               | career | Career Development     |        |
+               | ns   | School of Natural Sciences    | chem   | Chemistry              | ns     |
+               | eng  | School of Engineering         | comp   | Computer Science       | eng    |
+               | bus  | School of Business            | corpfi | Corporate Finance      | bus    |
+               | edu  | College of Education          | edpol  | Educational Policy     | edu    |
+               | eng  | School of Engineering         | ee     | Electrical Engineering | eng    |
+               | la   | School of Arts and Humanities | eng    | English                | la     |
+               | la   | School of Arts and Humanities | hist   | History                | la     |
+               | la   | School of Arts and Humanities | lang   | Foreign Languages      | la     |
+               | eng  | School of Engineering         | me     | Mechanical Engineering | eng    |
+               | ns   | School of Natural Sciences    | mth    | Mathematics            | ns     |
+               |      |                               | parent | Parents & Alumni       |        |
+               | ns   | School of Natural Sciences    | phys   | Physics                | ns     |
+               | mus  | School of Music & Dance       | pia    | Piano                  | mus    |
+               | la   | School of Arts and Humanities | poli   | Political Science      | la     |
+               | la   | School of Arts and Humanities | psych  | Psychology             | la     |
+               | art  | School of Art and Design      | stdart | Studio Art             | art    |
+               | mus  | School of Music & Dance       | str    | Strings                | mus    |
+               | edu  | College of Education          | tched  | Teacher Education      | edu    |
+               | mus  | School of Music & Dance       | voc    | Vocals                 | mus    |
+               | mus  | School of Music & Dance       | win    | Wind                   | mus    |
+                                                                                         (27 rows)
+
+               ----
+               /department.select(school.*,*)
+               SELECT "SCHOOL"."CODE",
+                      "SCHOOL"."NAME",
+                      "DEPARTMENT"."CODE",
+                      "DEPARTMENT"."NAME",
+                      "DEPARTMENT"."SCHOOL"
+               FROM "HTSQL_REGRESS"."DEPARTMENT" "DEPARTMENT"
+                    LEFT OUTER JOIN "HTSQL_REGRESS"."SCHOOL" "SCHOOL"
+                                    ON ("DEPARTMENT"."SCHOOL" = "SCHOOL"."CODE")
+               ORDER BY 3 ASC
         - id: aggregates
           tests:
           - uri: /exists(school)

test/regress/output/pgsql.yaml

                                ON ("program"."school" = "school"."code")
                WHERE ("school"."code" = 'art')
                ORDER BY "program"."school" ASC, "program"."code" ASC
+          - uri: /school.filter(code='ns')
+            status: 200 OK
+            headers:
+            - [Content-Type, text/plain; charset=UTF-8]
+            body: |2
+               | school                            |
+              -+-----------------------------------+-
+               | code | name                       |
+              -+------+----------------------------+-
+               | ns   | School of Natural Sciences |
+                                             (1 row)
+
+               ----
+               /school.filter(code='ns')
+               SELECT "school"."code",
+                      "school"."name"
+               FROM "ad"."school" AS "school"
+               WHERE ("school"."code" = 'ns')
+               ORDER BY 1 ASC
+          - uri: /department.filter(school.code={'art','la'})
+            status: 200 OK
+            headers:
+            - [Content-Type, text/plain; charset=UTF-8]
+            body: |2
+               | department                          |
+              -+-------------------------------------+-
+               | code   | name              | school |
+              -+--------+-------------------+--------+-
+               | arthis | Art History       | art    |
+               | eng    | English           | la     |
+               | hist   | History           | la     |
+               | lang   | Foreign Languages | la     |
+               | poli   | Political Science | la     |
+               | psych  | Psychology        | la     |
+               | stdart | Studio Art        | art    |
+                                              (7 rows)
+
+               ----
+               /department.filter(school.code={'art','la'})
+               SELECT "department"."code",
+                      "department"."name",
+                      "department"."school"
+               FROM "ad"."department" AS "department"
+                    LEFT OUTER JOIN "ad"."school" AS "school"
+                                    ON ("department"."school" = "school"."code")
+               WHERE ("school"."code" IN ('art', 'la'))
+               ORDER BY 1 ASC
         - id: simple-selectors
           tests:
           - uri: /school{name}
                     LEFT OUTER JOIN "ad"."school" AS "school"
                                     ON ("department"."school" = "school"."code")
                ORDER BY "department"."code" ASC
+          - uri: /school.select(name)
+            status: 200 OK
+            headers:
+            - [Content-Type, text/plain; charset=UTF-8]
+            body: |2
+               | school                        |
+              -+-------------------------------+-
+               | name                          |
+              -+-------------------------------+-
+               | School of Art and Design      |
+               | School of Business            |
+               | College of Education          |
+               | School of Engineering         |
+               | School of Arts and Humanities |
+               | School of Music & Dance       |
+               | School of Natural Sciences    |
+               | Public Honorariums            |
+               | School of Continuing Studies  |
+                                        (9 rows)
+
+               ----
+               /school.select(name)
+               SELECT "school"."name"
+               FROM "ad"."school" AS "school"
+               ORDER BY "school"."code" ASC
+          - uri: /department.select(school.*, *)
+            status: 200 OK
+            headers:
+            - [Content-Type, text/plain; charset=UTF-8]
+            body: |2
+               | department                                                                      |
+              -+---------------------------------------------------------------------------------+-
+               | code | name                          | code   | name                   | school |
+              -+------+-------------------------------+--------+------------------------+--------+-
+               | bus  | School of Business            | acc    | Accounting             | bus    |
+               | art  | School of Art and Design      | arthis | Art History            | art    |
+               | ns   | School of Natural Sciences    | astro  | Astronomy              | ns     |
+               | eng  | School of Engineering         | be     | Bioengineering         | eng    |
+               |      |                               | bursar | Bursar's Office        |        |
+               | bus  | School of Business            | capmrk | Capital Markets        | bus    |
+               |      |                               | career | Career Development     |        |
+               | ns   | School of Natural Sciences    | chem   | Chemistry              | ns     |
+               | eng  | School of Engineering         | comp   | Computer Science       | eng    |
+               | bus  | School of Business            | corpfi | Corporate Finance      | bus    |
+               | edu  | College of Education          | edpol  | Educational Policy     | edu    |
+               | eng  | School of Engineering         | ee     | Electrical Engineering | eng    |
+               | la   | School of Arts and Humanities | eng    | English                | la     |
+               | la   | School of Arts and Humanities | hist   | History                | la     |
+               | la   | School of Arts and Humanities | lang   | Foreign Languages      | la     |
+               | eng  | School of Engineering         | me     | Mechanical Engineering | eng    |
+               | ns   | School of Natural Sciences    | mth    | Mathematics            | ns     |
+               |      |                               | parent | Parents & Alumni       |        |
+               | ns   | School of Natural Sciences    | phys   | Physics                | ns     |
+               | mus  | School of Music & Dance       | pia    | Piano                  | mus    |
+               | la   | School of Arts and Humanities | poli   | Political Science      | la     |
+               | la   | School of Arts and Humanities | psych  | Psychology             | la     |
+               | art  | School of Art and Design      | stdart | Studio Art             | art    |
+               | mus  | School of Music & Dance       | str    | Strings                | mus    |
+               | edu  | College of Education          | tched  | Teacher Education      | edu    |
+               | mus  | School of Music & Dance       | voc    | Vocals                 | mus    |
+               | mus  | School of Music & Dance       | win    | Wind                   | mus    |
+                                                                                         (27 rows)
+
+               ----
+               /department.select(school.*,*)
+               SELECT "school"."code",
+                      "school"."name",
+                      "department"."code",
+                      "department"."name",
+                      "department"."school"
+               FROM "ad"."department" AS "department"
+                    LEFT OUTER JOIN "ad"."school" AS "school"
+                                    ON ("department"."school" = "school"."code")
+               ORDER BY 3 ASC
         - id: aggregates
           tests:
           - uri: /exists(school)

test/regress/output/sqlite.yaml

                                ON ("program"."school" = "school"."code")
                WHERE ("school"."code" = 'art')
                ORDER BY "program"."school" ASC, "program"."code" ASC
+          - uri: /school.filter(code='ns')
+            status: 200 OK
+            headers:
+            - [Content-Type, text/plain; charset=UTF-8]
+            body: |2
+               | school                            |
+              -+-----------------------------------+-
+               | code | name                       |
+              -+------+----------------------------+-
+               | ns   | School of Natural Sciences |
+                                             (1 row)
+
+               ----
+               /school.filter(code='ns')
+               SELECT "school"."code",
+                      "school"."name"
+               FROM "school" AS "school"
+               WHERE ("school"."code" = 'ns')
+               ORDER BY 1 ASC
+          - uri: /department.filter(school.code={'art','la'})
+            status: 200 OK
+            headers:
+            - [Content-Type, text/plain; charset=UTF-8]
+            body: |2
+               | department                          |
+              -+-------------------------------------+-
+               | code   | name              | school |
+              -+--------+-------------------+--------+-
+               | arthis | Art History       | art    |
+               | eng    | English           | la     |
+               | hist   | History           | la     |
+               | lang   | Foreign Languages | la     |
+               | poli   | Political Science | la     |
+               | psych  | Psychology        | la     |
+               | stdart | Studio Art        | art    |
+                                              (7 rows)
+
+               ----
+               /department.filter(school.code={'art','la'})
+               SELECT "department"."code",
+                      "department"."name",
+                      "department"."school"
+               FROM "department" AS "department"
+                    LEFT OUTER JOIN "school" AS "school"
+                                    ON ("department"."school" = "school"."code")
+               WHERE ("school"."code" IN ('art', 'la'))
+               ORDER BY 1 ASC
         - id: simple-selectors
           tests:
           - uri: /school{name}
                     LEFT OUTER JOIN "school" AS "school"
                                     ON ("department"."school" = "school"."code")
                ORDER BY "department"."code" ASC
+          - uri: /school.select(name)
+            status: 200 OK
+            headers:
+            - [Content-Type, text/plain; charset=UTF-8]
+            body: |2
+               | school                        |
+              -+-------------------------------+-
+               | name                          |
+              -+-------------------------------+-
+               | School of Art and Design      |
+               | School of Business            |
+               | College of Education          |
+               | School of Engineering         |
+               | School of Arts and Humanities |
+               | School of Music & Dance       |
+               | School of Natural Sciences    |
+               | Public Honorariums            |
+               | School of Continuing Studies  |
+                                        (9 rows)
+
+               ----
+               /school.select(name)
+               SELECT "school"."name"
+               FROM "school" AS "school"
+               ORDER BY "school"."code" ASC
+          - uri: /department.select(school.*, *)
+            status: 200 OK
+            headers:
+            - [Content-Type, text/plain; charset=UTF-8]
+            body: |2
+               | department                                                                      |
+              -+---------------------------------------------------------------------------------+-
+               | code | name                          | code   | name                   | school |
+              -+------+-------------------------------+--------+------------------------+--------+-
+               | bus  | School of Business            | acc    | Accounting             | bus    |
+               | art  | School of Art and Design      | arthis | Art History            | art    |
+               | ns   | School of Natural Sciences    | astro  | Astronomy              | ns     |
+               | eng  | School of Engineering         | be     | Bioengineering         | eng    |
+               |      |                               | bursar | Bursar's Office        |        |
+               | bus  | School of Business            | capmrk | Capital Markets        | bus    |
+               |      |                               | career | Career Development     |        |
+               | ns   | School of Natural Sciences    | chem   | Chemistry              | ns     |
+               | eng  | School of Engineering         | comp   | Computer Science       | eng    |
+               | bus  | School of Business            | corpfi | Corporate Finance      | bus    |
+               | edu  | College of Education          | edpol  | Educational Policy     | edu    |
+               | eng  | School of Engineering         | ee     | Electrical Engineering | eng    |
+               | la   | School of Arts and Humanities | eng    | English                | la     |
+               | la   | School of Arts and Humanities | hist   | History                | la     |
+               | la   | School of Arts and Humanities | lang   | Foreign Languages      | la     |
+               | eng  | School of Engineering         | me     | Mechanical Engineering | eng    |
+               | ns   | School of Natural Sciences    | mth    | Mathematics            | ns     |
+               |      |                               | parent | Parents & Alumni       |        |
+               | ns   | School of Natural Sciences    | phys   | Physics                | ns     |
+               | mus  | School of Music & Dance       | pia    | Piano                  | mus    |
+               | la   | School of Arts and Humanities | poli   | Political Science      | la     |
+               | la   | School of Arts and Humanities | psych  | Psychology             | la     |
+               | art  | School of Art and Design      | stdart | Studio Art             | art    |
+               | mus  | School of Music & Dance       | str    | Strings                | mus    |
+               | edu  | College of Education          | tched  | Teacher Education      | edu    |
+               | mus  | School of Music & Dance       | voc    | Vocals                 | mus    |
+               | mus  | School of Music & Dance       | win    | Wind                   | mus    |
+                                                                                         (27 rows)
+
+               ----
+               /department.select(school.*,*)
+               SELECT "school"."code",
+                      "school"."name",
+                      "department"."code",
+                      "department"."name",
+                      "department"."school"
+               FROM "department" AS "department"
+                    LEFT OUTER JOIN "school" AS "school"
+                                    ON ("department"."school" = "school"."code")
+               ORDER BY 3 ASC
         - id: aggregates
           tests:
           - uri: /exists(school)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.