Uploaded image for project: 'Apache MetaModel'
  1. Apache MetaModel
  2. METAMODEL-1165

Enhance query parser to support "default table"


    • Type: New Feature
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:


      For many datastore types there is only going to be one table in the default schema. Examples of this would be CSV files, most Excel spreadsheets, Fixed width files etc. Or just simple databases with just one table.

      It would be super convenient if I could express a string query (to be parsed) like this:

      SELECT * FROM default table

      (Although "default table" is maybe not an ideal identifier for this. To be revisited below)

      This would allow me to apply the same query to many datastores without having to spend time and energy finding out what the table name is. For example if I'm working on a lot of CSV files, I know that I can apply this same query again and again.

      The evaluation of the FROM clause would happen at query time. That way it wouldn't need to carry this information on to any MM submodule or anything like that. It would just enter the generic query parsing logic that also transforms the asterix in the SELECT clause into concrete select items.

      It's interesting to consider naming here. Default schemas are already supported, but they are unnamed because they exist simply when no schema is specified. But in a FROM clause we need some token for it to be valid SQL (or even just SQL-like) syntax. Therefore I could imagine a couple of possible tokens/syntaxes in addition to the "default table" idea above:

      1. SELECT * FROM default
      2. SELECT * FROM table
      3. SELECT * FROM tables[0]
      4. SELECT * FROM _

      I think I like option 3 or 4 most actually. Option 1 and 2 have the issues that there could be name clashes if there are actual table names called "default" or "table". It would be cool with the "tables[0]" option, and having the option to also reference non-zero table indices in there. That way you could even take the idea of querying generically further by doing so for all indices if you happen to know how many tables to expect.


        There are no comments yet on this issue.


          • Assignee:
            kaspersor Kasper Sørensen
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: