sqoop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "q79969786 (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (SQOOP-1654) Sqoop cannot export data to SQLServer except user's default schema
Date Sat, 01 Nov 2014 09:40:33 GMT

    [ https://issues.apache.org/jira/browse/SQOOP-1654?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14193040#comment-14193040
] 

q79969786 edited comment on SQOOP-1654 at 11/1/14 9:39 AM:
-----------------------------------------------------------

diff --git a/src/java/org/apache/sqoop/manager/SQLServerManager.java b/src/java/org/apache/sqoop/manager/SQLServerManager.java
index 60d380e..88af9cd 100644
--- a/src/java/org/apache/sqoop/manager/SQLServerManager.java
+++ b/src/java/org/apache/sqoop/manager/SQLServerManager.java
@@ -264,11 +264,7 @@ protected String getSchemaQuery() {
   }
   @Override
   protected String getListColumnsQuery(String tableName) {
-    return
-      "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS "
-    + "WHERE TABLE_SCHEMA = (" + getSchemaQuery() + ") "
-    + "  AND TABLE_NAME = N'" + tableName + "' "
-    + "  ORDER BY ORDINAL_POSITION";
+    return "SELECT NAME FROM SYSCOMLUMNS WHERE ID=OBJECT_ID('" + tableName + "')";
   }
 
   @Override
@@ -316,7 +312,7 @@ public String escapeObjectName(String objectName) {
     if (null == objectName) {
       return null;
     }
-    return "[" + objectName + "]";
+    return objectName;
   }
 
   /**


was (Author: q79969786):
I will try to fix it

> Sqoop cannot export data to SQLServer  except user's default schema
> -------------------------------------------------------------------
>
>                 Key: SQOOP-1654
>                 URL: https://issues.apache.org/jira/browse/SQOOP-1654
>             Project: Sqoop
>          Issue Type: Improvement
>    Affects Versions: 1.4.4
>         Environment: hadoop-1.2.1 + hive-0.12 + sqoop-1.4.4 + SQLServer 2008
>            Reporter: q79969786
>              Labels: patch
>             Fix For: 1.4.4
>
>
> if my default schame is dbo, I can export to table belongs dbo without specify schame
name, but if I  want to export to other schema, like [guest].[test], sqoop use ' SELECT t.*
FROM [[guest].[test]] AS t WHERE 1=0' to get column types. It will throw Exception.
> I try to fix it by modify org.apache.sqoop.manager.SQLServerManager ant it worked



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message