4 Replies Latest reply on Jun 11, 2018 7:52 AM by shawkins

    Problem querying specific tables with SimpleDB connector




      I am facing an issue while querying the Simple DB connector for a specific type of tables - the tables that contain a hyphen in the name.


      I am guessing these need to be according the quoting rules in the Simple DB doc which says

      Attribute and domain names may appear without quotes if they contain only letters, numbers, underscores (_), or dollar symbols ($) and do not start with a number. You must quote all other attribute and domain names with the backtick (`).

      (Select Quoting Rules - Amazon SimpleDB )


      I am getting an issue in the SimpleDBConnectionImpl class -> getAttributeNames while fetching the metadata. Could you confirm on this.





        • 1. Re: Problem querying specific tables with SimpleDB connector

          What is the issue you are facing? how did you import the metadata? Yes, if the translator already did not quote these tables then it is a bug, for which you can open a JIRA.

          • 2. Re: Problem querying specific tables with SimpleDB connector

            Thanks for the response. I am using Teiid embedded, where I have created something like a wrapper connector over the Teiid-provided simpledb db connector which delegates some of the calls to SimpleDBConnectionImpl. For fetching the metadata of the source, I call methods on this connection object very similar to what happens in the Teiid metadata processor. Here, SimpleDBConnectionImpl.getAttributeNames is failing for domainNames which have a hyphen etc.


            Have created a JIRA bug for the issue - TEIID-5363

            • 3. Re: Problem querying specific tables with SimpleDB connector

              Thanks for the resolution for TEIID-5363.

              But I am not really sure whether this workaround would solve the problem, looking at where exactly I am facing the issue. I am facing the issue in SimpleDBConnectionImpl.getAttributeNames. This method gets called from my class (which is similar to SimpleDBMetadataProcessor) with domain names which are obtained from a previous call SimpleDBConnectionImpl.getDomains (which returns non-quoted domain names). When this non-quoted domain name gets passed to getAttributeNames, it leads to a failure -- so when I essentially don't have the attributeNames yet, I can't quote them in the nameInSource property and proceed.

              Here's the stacktrace:


              Caused by: com.amazonaws.services.simpledb.model.InvalidQueryExpressionException: The specified query expression syntax is not valid. (Service: AmazonSimpl

              eDB; Status Code: 400; Error Code: InvalidQueryExpression; Request ID: b8d60ae4-9488-6f0e-214c-da4ff404dbb3)

                      at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:1305)

                      at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:852)

                      at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:630)

                      at com.amazonaws.http.AmazonHttpClient.doExecute(AmazonHttpClient.java:405)

                      at com.amazonaws.http.AmazonHttpClient.executeWithTimer(AmazonHttpClient.java:367)

                      at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:318)

                      at com.amazonaws.services.simpledb.AmazonSimpleDBClient.doInvoke(AmazonSimpleDBClient.java:1039)

                      at com.amazonaws.services.simpledb.AmazonSimpleDBClient.invoke(AmazonSimpleDBClient.java:1009)

                      at com.amazonaws.services.simpledb.AmazonSimpleDBClient.select(AmazonSimpleDBClient.java:958)

                      at org.teiid.resource.adapter.simpledb.SimpleDBConnectionImpl.getAttributeNames(SimpleDBConnectionImpl.java:90)

                      at com.test.simpledb.SimpleDBMetadataProvider.getColumnMetadata(SimpleDBMetadataProvider.java:100)

              • 4. Re: Problem querying specific tables with SimpleDB connector

                Please reopen the issue with that comment, and I'll have a look at addressing that.