Commits

Kirill Simonov committed 7b19226

Fixed tweak.shell and added tests for auxiliary commands.

Comments (0)

Files changed (8)

src/htsql/core/util.py

     Checks if a value is a list containing elements of the specified type.
 
     Use with ``isinstance()`` as in::
-    
+
         isinstance(X, listof(T))
     """
 
     Checks if a value is a set containing elements of the specified type.
 
     Use with ``isinstance()`` as in::
-    
+
         isinstance(X, setof(T))
     """
 
     the specified types.
 
     Use with ``isinstance()`` as in::
-    
+
         isinstance(X, dictof(T1, T2))
     """
 
     type.
 
     Use with ``isinstance()`` as in::
-    
+
         isinstance(X, omapof(T))
     """
 

src/htsql/tweak/shell/command.py

                             ListDomain, RecordDomain)
 from ...core.syn.syntax import StringSyntax, IntegerSyntax, IdentifierSyntax
 from ...core.cmd.command import UniversalCmd, Command, DefaultCmd
-from ...core.cmd.summon import Summon, RecognizeError
+from ...core.cmd.summon import Summon, RecognizeError, recognize
 from ...core.cmd.act import (Act, Action, RenderAction, UnsupportedActionError,
                              act, produce, safe_produce, analyze)
 from ...core.model import HomeNode, InvalidNode, InvalidArc
         self.can_write = can_write
 
 
-class ShellSig(Signature):
-
-    slots = [
-            Slot('query', is_mandatory=False),
-    ]
-
-
-class CompleteSig(Signature):
-
-    slots = [
-            Slot('names', is_mandatory=False, is_singular=False),
-    ]
-
-
-class ProduceSig(Signature):
-
-    slots = [
-            Slot('query'),
-            Slot('page', is_mandatory=False),
-    ]
-
-
-class AnalyzeSig(Signature):
-
-    slots = [
-            Slot('query'),
-    ]
-
-
-class WithPermissionsSig(Signature):
-
-    slots = [
-            Slot('query'),
-            Slot('can_read'),
-            Slot('can_write'),
-    ]
-
-
 class SummonShell(Summon):
 
     call('shell')
                 if page is not None and page > 0 and addon.limit is not None:
                     limit = page*addon.limit
                 if limit is not None:
-                    product = safe_produce(command, limit+1)
+                    product = safe_produce(command, cut=limit+1)
                 else:
                     product = produce(command)
         except UnsupportedActionError, exc:

test/input/addon.yaml

   - uri: /shell()
     ignore: true
 
-  # FIXME: add tests for auxiliary commands
+  # Auxiliary commands
+  - uri: /complete()
+  - uri: /complete(school)
+  - uri: /complete(department, course)
+  - uri: /produce('/school')
+  - uri: /produce('/school', 3)
+  - uri: /analyze('/school')
+  - uri: /with_permissions(/produce('/school:top'), 'true', 'false')
+  - uri: /with_permissions(/produce('/school:top'), 'false', 'false')
 
   # Using `/shell()` as the default command
   - load: demo

test/output/mssql.yaml

 
             </html>
 
+        - uri: /complete()
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "complete",
+              "names": [
+                "course",
+                "department",
+                "program",
+                "school",
+                "class",
+                "semester",
+                "enrollment",
+                "student",
+                "appointment",
+                "confidential",
+                "instructor",
+                "classification",
+                "course_classification",
+                "prerequisite",
+                "program_requirement"
+              ]
+            }
+        - uri: /complete(school)
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "complete",
+              "names": [
+                "code",
+                "name",
+                "campus",
+                "department",
+                "program"
+              ]
+            }
+        - uri: /complete(department, course)
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "complete",
+              "names": [
+                "department_code",
+                "no",
+                "title",
+                "credits",
+                "description",
+                "department",
+                "class",
+                "prerequisite_via_on_course",
+                "prerequisite_via_of_course",
+                "course_classification"
+              ]
+            }
+        - uri: /produce('/school')
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "product",
+              "meta": {
+                "domain": {
+                  "type": "list",
+                  "item": {
+                    "domain": {
+                      "type": "record",
+                      "fields": [
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "code",
+                          "path": "school.code",
+                          "syntax": "code",
+                          "tag": "code"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "name",
+                          "path": "school.name",
+                          "syntax": "name",
+                          "tag": "name"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "campus",
+                          "path": "school.campus",
+                          "syntax": "campus",
+                          "tag": "campus"
+                        }
+                      ]
+                    }
+                  }
+                },
+                "header": "school",
+                "path": "school",
+                "syntax": "\/school",
+                "tag": "school"
+              },
+              "data": [
+                [
+                  "art",
+                  "School of Art & Design",
+                  "old"
+                ],
+                [
+                  "bus",
+                  "School of Business",
+                  "south"
+                ],
+                [
+                  "edu",
+                  "College of Education",
+                  "old"
+                ],
+                [
+                  "eng",
+                  "School of Engineering",
+                  "north"
+                ],
+                [
+                  "la",
+                  "School of Arts and Humanities",
+                  "old"
+                ],
+                [
+                  "mus",
+                  "School of Music & Dance",
+                  "south"
+                ],
+                [
+                  "ns",
+                  "School of Natural Sciences",
+                  "old"
+                ],
+                [
+                  "ph",
+                  "Public Honorariums",
+                  null
+                ],
+                [
+                  "sc",
+                  "School of Continuing Studies",
+                  null
+                ]
+              ],
+              "more": false
+            }
+        - uri: /produce('/school', 3)
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "product",
+              "meta": {
+                "domain": {
+                  "type": "list",
+                  "item": {
+                    "domain": {
+                      "type": "record",
+                      "fields": [
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "code",
+                          "path": "school.code",
+                          "syntax": "code",
+                          "tag": "code"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "name",
+                          "path": "school.name",
+                          "syntax": "name",
+                          "tag": "name"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "campus",
+                          "path": "school.campus",
+                          "syntax": "campus",
+                          "tag": "campus"
+                        }
+                      ]
+                    }
+                  }
+                },
+                "header": "school",
+                "path": "school",
+                "syntax": "\/school",
+                "tag": "school"
+              },
+              "data": [
+                [
+                  "art",
+                  "School of Art & Design",
+                  "old"
+                ],
+                [
+                  "bus",
+                  "School of Business",
+                  "south"
+                ],
+                [
+                  "edu",
+                  "College of Education",
+                  "old"
+                ],
+                [
+                  "eng",
+                  "School of Engineering",
+                  "north"
+                ],
+                [
+                  "la",
+                  "School of Arts and Humanities",
+                  "old"
+                ],
+                [
+                  "mus",
+                  "School of Music & Dance",
+                  "south"
+                ],
+                [
+                  "ns",
+                  "School of Natural Sciences",
+                  "old"
+                ],
+                [
+                  "ph",
+                  "Public Honorariums",
+                  null
+                ],
+                [
+                  "sc",
+                  "School of Continuing Studies",
+                  null
+                ]
+              ],
+              "more": false
+            }
+        - uri: /analyze('/school')
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "sql",
+              "sql": "SELECT [school].[code],\n       [school].[name],\n       [school].[campus]\nFROM [ad].[school]\nORDER BY 1 ASC\n"
+            }
+        - uri: /with_permissions(/produce('/school:top'), 'true', 'false')
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "product",
+              "meta": {
+                "domain": {
+                  "type": "list",
+                  "item": {
+                    "domain": {
+                      "type": "record",
+                      "fields": [
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "code",
+                          "path": "school.code",
+                          "syntax": "code",
+                          "tag": "code"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "name",
+                          "path": "school.name",
+                          "syntax": "name",
+                          "tag": "name"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "campus",
+                          "path": "school.campus",
+                          "syntax": "campus",
+                          "tag": "campus"
+                        }
+                      ]
+                    }
+                  }
+                },
+                "header": "school",
+                "path": "school",
+                "syntax": "\/school :top",
+                "tag": "school"
+              },
+              "data": [
+                [
+                  "art",
+                  "School of Art & Design",
+                  "old"
+                ]
+              ],
+              "more": false
+            }
+        - uri: /with_permissions(/produce('/school:top'), 'false', 'false')
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "permissions",
+              "detail": "not enough permissions to execute the query"
+            }
         - uri: /
           status: 200 OK
           headers:

test/output/mysql.yaml

 
             </html>
 
+        - uri: /complete()
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "complete",
+              "names": [
+                "appointment",
+                "class",
+                "classification",
+                "confidential",
+                "course",
+                "course_classification",
+                "department",
+                "enrollment",
+                "instructor",
+                "prerequisite",
+                "program",
+                "program_requirement",
+                "school",
+                "semester",
+                "student"
+              ]
+            }
+        - uri: /complete(school)
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "complete",
+              "names": [
+                "code",
+                "name",
+                "campus",
+                "department",
+                "program"
+              ]
+            }
+        - uri: /complete(department, course)
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "complete",
+              "names": [
+                "department_code",
+                "no",
+                "title",
+                "credits",
+                "description",
+                "department",
+                "class",
+                "course_classification",
+                "prerequisite_via_of_course",
+                "prerequisite_via_on_course"
+              ]
+            }
+        - uri: /produce('/school')
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "product",
+              "meta": {
+                "domain": {
+                  "type": "list",
+                  "item": {
+                    "domain": {
+                      "type": "record",
+                      "fields": [
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "code",
+                          "path": "school.code",
+                          "syntax": "code",
+                          "tag": "code"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "name",
+                          "path": "school.name",
+                          "syntax": "name",
+                          "tag": "name"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "campus",
+                          "path": "school.campus",
+                          "syntax": "campus",
+                          "tag": "campus"
+                        }
+                      ]
+                    }
+                  }
+                },
+                "header": "school",
+                "path": "school",
+                "syntax": "\/school",
+                "tag": "school"
+              },
+              "data": [
+                [
+                  "art",
+                  "School of Art & Design",
+                  "old"
+                ],
+                [
+                  "bus",
+                  "School of Business",
+                  "south"
+                ],
+                [
+                  "edu",
+                  "College of Education",
+                  "old"
+                ],
+                [
+                  "eng",
+                  "School of Engineering",
+                  "north"
+                ],
+                [
+                  "la",
+                  "School of Arts and Humanities",
+                  "old"
+                ],
+                [
+                  "mus",
+                  "School of Music & Dance",
+                  "south"
+                ],
+                [
+                  "ns",
+                  "School of Natural Sciences",
+                  "old"
+                ],
+                [
+                  "ph",
+                  "Public Honorariums",
+                  null
+                ],
+                [
+                  "sc",
+                  "School of Continuing Studies",
+                  null
+                ]
+              ],
+              "more": false
+            }
+        - uri: /produce('/school', 3)
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "product",
+              "meta": {
+                "domain": {
+                  "type": "list",
+                  "item": {
+                    "domain": {
+                      "type": "record",
+                      "fields": [
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "code",
+                          "path": "school.code",
+                          "syntax": "code",
+                          "tag": "code"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "name",
+                          "path": "school.name",
+                          "syntax": "name",
+                          "tag": "name"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "campus",
+                          "path": "school.campus",
+                          "syntax": "campus",
+                          "tag": "campus"
+                        }
+                      ]
+                    }
+                  }
+                },
+                "header": "school",
+                "path": "school",
+                "syntax": "\/school",
+                "tag": "school"
+              },
+              "data": [
+                [
+                  "art",
+                  "School of Art & Design",
+                  "old"
+                ],
+                [
+                  "bus",
+                  "School of Business",
+                  "south"
+                ],
+                [
+                  "edu",
+                  "College of Education",
+                  "old"
+                ],
+                [
+                  "eng",
+                  "School of Engineering",
+                  "north"
+                ],
+                [
+                  "la",
+                  "School of Arts and Humanities",
+                  "old"
+                ],
+                [
+                  "mus",
+                  "School of Music & Dance",
+                  "south"
+                ],
+                [
+                  "ns",
+                  "School of Natural Sciences",
+                  "old"
+                ],
+                [
+                  "ph",
+                  "Public Honorariums",
+                  null
+                ],
+                [
+                  "sc",
+                  "School of Continuing Studies",
+                  null
+                ]
+              ],
+              "more": false
+            }
+        - uri: /analyze('/school')
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "sql",
+              "sql": "SELECT `school`.`code`,\n       `school`.`name`,\n       `school`.`campus`\nFROM `school`\nORDER BY 1 ASC\n"
+            }
+        - uri: /with_permissions(/produce('/school:top'), 'true', 'false')
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "product",
+              "meta": {
+                "domain": {
+                  "type": "list",
+                  "item": {
+                    "domain": {
+                      "type": "record",
+                      "fields": [
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "code",
+                          "path": "school.code",
+                          "syntax": "code",
+                          "tag": "code"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "name",
+                          "path": "school.name",
+                          "syntax": "name",
+                          "tag": "name"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "campus",
+                          "path": "school.campus",
+                          "syntax": "campus",
+                          "tag": "campus"
+                        }
+                      ]
+                    }
+                  }
+                },
+                "header": "school",
+                "path": "school",
+                "syntax": "\/school :top",
+                "tag": "school"
+              },
+              "data": [
+                [
+                  "art",
+                  "School of Art & Design",
+                  "old"
+                ]
+              ],
+              "more": false
+            }
+        - uri: /with_permissions(/produce('/school:top'), 'false', 'false')
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "permissions",
+              "detail": "not enough permissions to execute the query"
+            }
         - uri: /
           status: 200 OK
           headers:

test/output/oracle.yaml

 
             </html>
 
+        - uri: /complete()
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "complete",
+              "names": [
+                "appointment",
+                "class",
+                "classification",
+                "confidential",
+                "course",
+                "course_classification",
+                "department",
+                "enrollment",
+                "instructor",
+                "prerequisite",
+                "program",
+                "program_requirement",
+                "school",
+                "semester",
+                "student"
+              ]
+            }
+        - uri: /complete(school)
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "complete",
+              "names": [
+                "code",
+                "name",
+                "campus",
+                "department",
+                "program"
+              ]
+            }
+        - uri: /complete(department, course)
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "complete",
+              "names": [
+                "department_code",
+                "no",
+                "title",
+                "credits",
+                "description",
+                "department",
+                "class",
+                "course_classification",
+                "prerequisite_via_of_course",
+                "prerequisite_via_on_course"
+              ]
+            }
+        - uri: /produce('/school')
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "product",
+              "meta": {
+                "domain": {
+                  "type": "list",
+                  "item": {
+                    "domain": {
+                      "type": "record",
+                      "fields": [
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "code",
+                          "path": "school.code",
+                          "syntax": "code",
+                          "tag": "code"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "name",
+                          "path": "school.name",
+                          "syntax": "name",
+                          "tag": "name"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "campus",
+                          "path": "school.campus",
+                          "syntax": "campus",
+                          "tag": "campus"
+                        }
+                      ]
+                    }
+                  }
+                },
+                "header": "school",
+                "path": "school",
+                "syntax": "\/school",
+                "tag": "school"
+              },
+              "data": [
+                [
+                  "art",
+                  "School of Art & Design",
+                  "old"
+                ],
+                [
+                  "bus",
+                  "School of Business",
+                  "south"
+                ],
+                [
+                  "edu",
+                  "College of Education",
+                  "old"
+                ],
+                [
+                  "eng",
+                  "School of Engineering",
+                  "north"
+                ],
+                [
+                  "la",
+                  "School of Arts and Humanities",
+                  "old"
+                ],
+                [
+                  "mus",
+                  "School of Music & Dance",
+                  "south"
+                ],
+                [
+                  "ns",
+                  "School of Natural Sciences",
+                  "old"
+                ],
+                [
+                  "ph",
+                  "Public Honorariums",
+                  null
+                ],
+                [
+                  "sc",
+                  "School of Continuing Studies",
+                  null
+                ]
+              ],
+              "more": false
+            }
+        - uri: /produce('/school', 3)
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "product",
+              "meta": {
+                "domain": {
+                  "type": "list",
+                  "item": {
+                    "domain": {
+                      "type": "record",
+                      "fields": [
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "code",
+                          "path": "school.code",
+                          "syntax": "code",
+                          "tag": "code"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "name",
+                          "path": "school.name",
+                          "syntax": "name",
+                          "tag": "name"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "campus",
+                          "path": "school.campus",
+                          "syntax": "campus",
+                          "tag": "campus"
+                        }
+                      ]
+                    }
+                  }
+                },
+                "header": "school",
+                "path": "school",
+                "syntax": "\/school",
+                "tag": "school"
+              },
+              "data": [
+                [
+                  "art",
+                  "School of Art & Design",
+                  "old"
+                ],
+                [
+                  "bus",
+                  "School of Business",
+                  "south"
+                ],
+                [
+                  "edu",
+                  "College of Education",
+                  "old"
+                ],
+                [
+                  "eng",
+                  "School of Engineering",
+                  "north"
+                ],
+                [
+                  "la",
+                  "School of Arts and Humanities",
+                  "old"
+                ],
+                [
+                  "mus",
+                  "School of Music & Dance",
+                  "south"
+                ],
+                [
+                  "ns",
+                  "School of Natural Sciences",
+                  "old"
+                ],
+                [
+                  "ph",
+                  "Public Honorariums",
+                  null
+                ],
+                [
+                  "sc",
+                  "School of Continuing Studies",
+                  null
+                ]
+              ],
+              "more": false
+            }
+        - uri: /analyze('/school')
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "sql",
+              "sql": "SELECT \"SCHOOL\".\"CODE\",\n       \"SCHOOL\".\"NAME\",\n       \"SCHOOL\".\"CAMPUS\"\nFROM \"SCHOOL\"\nORDER BY 1 ASC\n"
+            }
+        - uri: /with_permissions(/produce('/school:top'), 'true', 'false')
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "product",
+              "meta": {
+                "domain": {
+                  "type": "list",
+                  "item": {
+                    "domain": {
+                      "type": "record",
+                      "fields": [
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "code",
+                          "path": "school.code",
+                          "syntax": "code",
+                          "tag": "code"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "name",
+                          "path": "school.name",
+                          "syntax": "name",
+                          "tag": "name"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "campus",
+                          "path": "school.campus",
+                          "syntax": "campus",
+                          "tag": "campus"
+                        }
+                      ]
+                    }
+                  }
+                },
+                "header": "school",
+                "path": "school",
+                "syntax": "\/school :top",
+                "tag": "school"
+              },
+              "data": [
+                [
+                  "art",
+                  "School of Art & Design",
+                  "old"
+                ]
+              ],
+              "more": false
+            }
+        - uri: /with_permissions(/produce('/school:top'), 'false', 'false')
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "permissions",
+              "detail": "not enough permissions to execute the query"
+            }
         - uri: /
           status: 200 OK
           headers:

test/output/pgsql.yaml

 
             </html>
 
+        - uri: /complete()
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "complete",
+              "names": [
+                "course",
+                "department",
+                "program",
+                "school",
+                "class",
+                "semester",
+                "enrollment",
+                "student",
+                "appointment",
+                "confidential",
+                "instructor",
+                "classification",
+                "course_classification",
+                "prerequisite",
+                "program_requirement"
+              ]
+            }
+        - uri: /complete(school)
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "complete",
+              "names": [
+                "code",
+                "name",
+                "campus",
+                "department",
+                "program"
+              ]
+            }
+        - uri: /complete(department, course)
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "complete",
+              "names": [
+                "department_code",
+                "no",
+                "title",
+                "credits",
+                "description",
+                "department",
+                "class",
+                "prerequisite_via_on_course",
+                "prerequisite_via_of_course",
+                "course_classification"
+              ]
+            }
+        - uri: /produce('/school')
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "product",
+              "meta": {
+                "domain": {
+                  "type": "list",
+                  "item": {
+                    "domain": {
+                      "type": "record",
+                      "fields": [
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "code",
+                          "path": "school.code",
+                          "syntax": "code",
+                          "tag": "code"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "name",
+                          "path": "school.name",
+                          "syntax": "name",
+                          "tag": "name"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "campus",
+                          "path": "school.campus",
+                          "syntax": "campus",
+                          "tag": "campus"
+                        }
+                      ]
+                    }
+                  }
+                },
+                "header": "school",
+                "path": "school",
+                "syntax": "\/school",
+                "tag": "school"
+              },
+              "data": [
+                [
+                  "art",
+                  "School of Art & Design",
+                  "old"
+                ],
+                [
+                  "bus",
+                  "School of Business",
+                  "south"
+                ],
+                [
+                  "edu",
+                  "College of Education",
+                  "old"
+                ],
+                [
+                  "eng",
+                  "School of Engineering",
+                  "north"
+                ],
+                [
+                  "la",
+                  "School of Arts and Humanities",
+                  "old"
+                ],
+                [
+                  "mus",
+                  "School of Music & Dance",
+                  "south"
+                ],
+                [
+                  "ns",
+                  "School of Natural Sciences",
+                  "old"
+                ],
+                [
+                  "ph",
+                  "Public Honorariums",
+                  null
+                ],
+                [
+                  "sc",
+                  "School of Continuing Studies",
+                  null
+                ]
+              ],
+              "more": false
+            }
+        - uri: /produce('/school', 3)
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "product",
+              "meta": {
+                "domain": {
+                  "type": "list",
+                  "item": {
+                    "domain": {
+                      "type": "record",
+                      "fields": [
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "code",
+                          "path": "school.code",
+                          "syntax": "code",
+                          "tag": "code"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "name",
+                          "path": "school.name",
+                          "syntax": "name",
+                          "tag": "name"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "campus",
+                          "path": "school.campus",
+                          "syntax": "campus",
+                          "tag": "campus"
+                        }
+                      ]
+                    }
+                  }
+                },
+                "header": "school",
+                "path": "school",
+                "syntax": "\/school",
+                "tag": "school"
+              },
+              "data": [
+                [
+                  "art",
+                  "School of Art & Design",
+                  "old"
+                ],
+                [
+                  "bus",
+                  "School of Business",
+                  "south"
+                ],
+                [
+                  "edu",
+                  "College of Education",
+                  "old"
+                ],
+                [
+                  "eng",
+                  "School of Engineering",
+                  "north"
+                ],
+                [
+                  "la",
+                  "School of Arts and Humanities",
+                  "old"
+                ],
+                [
+                  "mus",
+                  "School of Music & Dance",
+                  "south"
+                ],
+                [
+                  "ns",
+                  "School of Natural Sciences",
+                  "old"
+                ],
+                [
+                  "ph",
+                  "Public Honorariums",
+                  null
+                ],
+                [
+                  "sc",
+                  "School of Continuing Studies",
+                  null
+                ]
+              ],
+              "more": false
+            }
+        - uri: /analyze('/school')
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "sql",
+              "sql": "SELECT \"school\".\"code\",\n       \"school\".\"name\",\n       \"school\".\"campus\"\nFROM \"ad\".\"school\"\nORDER BY 1 ASC\n"
+            }
+        - uri: /with_permissions(/produce('/school:top'), 'true', 'false')
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "product",
+              "meta": {
+                "domain": {
+                  "type": "list",
+                  "item": {
+                    "domain": {
+                      "type": "record",
+                      "fields": [
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "code",
+                          "path": "school.code",
+                          "syntax": "code",
+                          "tag": "code"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "name",
+                          "path": "school.name",
+                          "syntax": "name",
+                          "tag": "name"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "campus",
+                          "path": "school.campus",
+                          "syntax": "campus",
+                          "tag": "campus"
+                        }
+                      ]
+                    }
+                  }
+                },
+                "header": "school",
+                "path": "school",
+                "syntax": "\/school :top",
+                "tag": "school"
+              },
+              "data": [
+                [
+                  "art",
+                  "School of Art & Design",
+                  "old"
+                ]
+              ],
+              "more": false
+            }
+        - uri: /with_permissions(/produce('/school:top'), 'false', 'false')
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "permissions",
+              "detail": "not enough permissions to execute the query"
+            }
         - uri: /
           status: 200 OK
           headers:

test/output/sqlite.yaml

 
             </html>
 
+        - uri: /complete()
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "complete",
+              "names": [
+                "appointment",
+                "class",
+                "classification",
+                "confidential",
+                "course",
+                "course_classification",
+                "department",
+                "enrollment",
+                "instructor",
+                "prerequisite",
+                "program",
+                "program_requirement",
+                "school",
+                "semester",
+                "student"
+              ]
+            }
+        - uri: /complete(school)
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "complete",
+              "names": [
+                "code",
+                "name",
+                "campus",
+                "department",
+                "program"
+              ]
+            }
+        - uri: /complete(department, course)
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "complete",
+              "names": [
+                "department_code",
+                "no",
+                "title",
+                "credits",
+                "description",
+                "department",
+                "class",
+                "course_classification",
+                "prerequisite_via_of_course",
+                "prerequisite_via_on_course"
+              ]
+            }
+        - uri: /produce('/school')
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "product",
+              "meta": {
+                "domain": {
+                  "type": "list",
+                  "item": {
+                    "domain": {
+                      "type": "record",
+                      "fields": [
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "code",
+                          "path": "school.code",
+                          "syntax": "code",
+                          "tag": "code"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "name",
+                          "path": "school.name",
+                          "syntax": "name",
+                          "tag": "name"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "campus",
+                          "path": "school.campus",
+                          "syntax": "campus",
+                          "tag": "campus"
+                        }
+                      ]
+                    }
+                  }
+                },
+                "header": "school",
+                "path": "school",
+                "syntax": "\/school",
+                "tag": "school"
+              },
+              "data": [
+                [
+                  "art",
+                  "School of Art & Design",
+                  "old"
+                ],
+                [
+                  "bus",
+                  "School of Business",
+                  "south"
+                ],
+                [
+                  "edu",
+                  "College of Education",
+                  "old"
+                ],
+                [
+                  "eng",
+                  "School of Engineering",
+                  "north"
+                ],
+                [
+                  "la",
+                  "School of Arts and Humanities",
+                  "old"
+                ],
+                [
+                  "mus",
+                  "School of Music & Dance",
+                  "south"
+                ],
+                [
+                  "ns",
+                  "School of Natural Sciences",
+                  "old"
+                ],
+                [
+                  "ph",
+                  "Public Honorariums",
+                  null
+                ],
+                [
+                  "sc",
+                  "School of Continuing Studies",
+                  null
+                ]
+              ],
+              "more": false
+            }
+        - uri: /produce('/school', 3)
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "product",
+              "meta": {
+                "domain": {
+                  "type": "list",
+                  "item": {
+                    "domain": {
+                      "type": "record",
+                      "fields": [
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "code",
+                          "path": "school.code",
+                          "syntax": "code",
+                          "tag": "code"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "name",
+                          "path": "school.name",
+                          "syntax": "name",
+                          "tag": "name"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "campus",
+                          "path": "school.campus",
+                          "syntax": "campus",
+                          "tag": "campus"
+                        }
+                      ]
+                    }
+                  }
+                },
+                "header": "school",
+                "path": "school",
+                "syntax": "\/school",
+                "tag": "school"
+              },
+              "data": [
+                [
+                  "art",
+                  "School of Art & Design",
+                  "old"
+                ],
+                [
+                  "bus",
+                  "School of Business",
+                  "south"
+                ],
+                [
+                  "edu",
+                  "College of Education",
+                  "old"
+                ],
+                [
+                  "eng",
+                  "School of Engineering",
+                  "north"
+                ],
+                [
+                  "la",
+                  "School of Arts and Humanities",
+                  "old"
+                ],
+                [
+                  "mus",
+                  "School of Music & Dance",
+                  "south"
+                ],
+                [
+                  "ns",
+                  "School of Natural Sciences",
+                  "old"
+                ],
+                [
+                  "ph",
+                  "Public Honorariums",
+                  null
+                ],
+                [
+                  "sc",
+                  "School of Continuing Studies",
+                  null
+                ]
+              ],
+              "more": false
+            }
+        - uri: /analyze('/school')
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "sql",
+              "sql": "SELECT \"school\".\"code\",\n       \"school\".\"name\",\n       \"school\".\"campus\"\nFROM \"school\"\nORDER BY 1 ASC\n"
+            }
+        - uri: /with_permissions(/produce('/school:top'), 'true', 'false')
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "product",
+              "meta": {
+                "domain": {
+                  "type": "list",
+                  "item": {
+                    "domain": {
+                      "type": "record",
+                      "fields": [
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "code",
+                          "path": "school.code",
+                          "syntax": "code",
+                          "tag": "code"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "name",
+                          "path": "school.name",
+                          "syntax": "name",
+                          "tag": "name"
+                        },
+                        {
+                          "domain": {
+                            "type": "string"
+                          },
+                          "header": "campus",
+                          "path": "school.campus",
+                          "syntax": "campus",
+                          "tag": "campus"
+                        }
+                      ]
+                    }
+                  }
+                },
+                "header": "school",
+                "path": "school",
+                "syntax": "\/school :top",
+                "tag": "school"
+              },
+              "data": [
+                [
+                  "art",
+                  "School of Art & Design",
+                  "old"
+                ]
+              ],
+              "more": false
+            }
+        - uri: /with_permissions(/produce('/school:top'), 'false', 'false')
+          status: 200 OK
+          headers:
+          - [Content-Type, application/javascript]
+          body: |
+            {
+              "type": "permissions",
+              "detail": "not enough permissions to execute the query"
+            }
         - uri: /
           status: 200 OK
           headers: