[teiid-issues] [JBoss JIRA] (TEIID-4928) Couchbase - NAMEINSOURCE required for all the columns and tables

Kylin Soong (JIRA) issues at jboss.org
Thu May 25 07:21:00 EDT 2017


    [ https://issues.jboss.org/browse/TEIID-4928?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13411847#comment-13411847 ] 

Kylin Soong commented on TEIID-4928:
------------------------------------

Hi Juraj Duráni 

Thanks for your comments.

Let's back to the original concern, let's add a note in document to address that the recommend way it to use teiid generated schema, if define the schema manually, the NAMEINSOURCE required for all the columns and tables, and also add more content with how de set OPTIONS and rules to define NAMEINSOURCE.

For the suggestion you raised at the end of above comments, I have add a PR(https://github.com/teiid/teiid/pull/963), with this PR, now, you design DDL can avoid add "teiid_couchbase:ISARRAYTABLE" 'false', :). To rename the Option name, there are too much change, especially test related change. 

For table name map to keyspace name in couchbase, I would use CustomerOrder example as [1]. Note a json document contain "type": "Customer" exsit in test keysapce. If you define importer property typeNameList values as
{code}
`test`:`type`
{code}
then CouchbaseMetadataProcessor auto-generated ddl as [2], note that the table name is Customer, if you query against it
{code}
SELECT * FROM Customer
{code}
in translator, the query will be translate to
{code}
SELECT ... FROM `test` ...
{code}
Note that you query against table is Customer, but the souce query is against on keyspace test. [3] is the completed source level N1ql. [4] is the embedded CustomerOrder example.

Appreciate you can find more defects, appreciate also you can file new JIRA for new dfects.

Kylin


[1] https://teiid.gitbooks.io/documents/content/reference/couchbase_translator.html#_an_example_of_schema_generation
[2] https://raw.githubusercontent.com/teiid/teiid/master/connectors/couchbase/translator-couchbase/src/test/resources/customerOrderTypedName.expected
[3] SELECT `$cb_c1_documentID`, `$cb_c2_ID`, `$cb_c3_type`, `$cb_c4_Name` FROM `test` `$cb_t1` LET `$cb_c1_documentID` = META(`$cb_t1`).id, `$cb_c2_ID` = `$cb_t1`.`ID`, `$cb_c3_type` = `$cb_t1`.`type`, `$cb_c4_Name` = `$cb_t1`.`Name` WHERE `$cb_c3_type` = 'Customer'
[4] https://github.com/teiid/teiid-embedded-examples/tree/master/couchbase-as-a-datasource


> Couchbase - NAMEINSOURCE required for all the columns and tables
> ----------------------------------------------------------------
>
>                 Key: TEIID-4928
>                 URL: https://issues.jboss.org/browse/TEIID-4928
>             Project: Teiid
>          Issue Type: Bug
>          Components: Misc. Connectors
>    Affects Versions: 9.3
>            Reporter: Juraj Duráni
>            Assignee: Kylin Soong
>
> Option *NAMEINSOURCE* is de facto required for all the columns and tables. If it is not present then:
> # column name in source query is not enclosed in back quotes - e.g. *`$cb_t1`.ShortValue* instead of *`$cb_t1`.`ShortValue`*
> # name of the table is not added to the source query - e.g. *SELECT ... FROM null `$cb_t1` LET ... WHERE ...* instead of *SELECT ... FROM `smalla` `$cb_t1` LET ... WHERE ...*
> This should work OOB without need to add NAMEINSOURCE option. Teiid should automatically translate column name from e.g. *MyColumn* to *`MyColumn`* if option is not set. Same with name of the table.
> In case of table I think this is more serious as it does not even try name of the table but supplies *null* to the query



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)



More information about the teiid-issues mailing list