sql-machine-learning / gomaxcompute

A Go driver for MaxCompute.
41 stars 11 forks source link

Drop table error: `unsupported format text` #39

Closed weiguoz closed 5 years ago

weiguoz commented 5 years ago

I added a drop table test and got an error: unsupported format text seems returned from here

tonyyang-svail commented 5 years ago

You are right. A simple fix is just removing that check. This would work for statements like create table and drop table, because the server doesn't return any data in these cases.

<?xml version="1.0"?>
<Instance>
  <Tasks>
    <Task Type="SQL">
      <Name>AnonymousSQLTask</Name>
      <Result Format="text"><![CDATA[
]]></Result>
    </Task>
  </Tasks>
</Instance>

However, for show tables;, the server returns

<?xml version="1.0"?>
<Instance>
  <Tasks>
    <Task Type="SQL">
      <Name>AnonymousSQLTask</Name>
      <Result Format="text"><![CDATA[1829387660937356:churn_test
1829387660937356:churn_train
1829387660937356:gomaxcompute_test
1829387660937356:gomaxcompute_test_query_base64
1829387660937356:iris_test
1829387660937356:iris_train
1829387660937356:my_dnn_model
1829387660937356:yiyang_test_table1
]]></Result>
    </Task>
  </Tasks>
</Instance>

Not sure how to convert the raw text to the rows.

weiguoz commented 5 years ago

Exec(sql) returns Result, we just test if the operation executed correctly. Query(sql) returns Rows, we need to convert So how about we handle the result of Exec(sql) which referred by #15 Then consider the converting from raw text to rows.

I noticed 1829387660937356 is the userId of the user described by DSN.