You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@metamodel.apache.org by "Kasper Sørensen (JIRA)" <ji...@apache.org> on 2017/11/02 03:59:00 UTC

[jira] [Resolved] (METAMODEL-1165) Enhance query parser to support "default table"

     [ https://issues.apache.org/jira/browse/METAMODEL-1165?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kasper Sørensen resolved METAMODEL-1165.
----------------------------------------
       Resolution: Fixed
    Fix Version/s: 5.0.0

> Enhance query parser to support "default table"
> -----------------------------------------------
>
>                 Key: METAMODEL-1165
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-1165
>             Project: Apache MetaModel
>          Issue Type: New Feature
>            Reporter: Kasper Sørensen
>            Assignee: Kasper Sørensen
>            Priority: Major
>             Fix For: 5.0.0
>
>
> 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:
> {code}
> SELECT * FROM default table
> {code}
> (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:
> # SELECT * FROM default
> #  SELECT * FROM table
> #  SELECT * FROM tables[0]
> #  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.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)