sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kathl...@apache.org
Subject git commit: SQOOP-1042: Sqoop2: Name constraints in Derby repository
Date Mon, 13 May 2013 04:16:15 GMT
Updated Branches:
  refs/heads/sqoop2 c452ffcaa -> 67f634034


SQOOP-1042: Sqoop2: Name constraints in Derby repository

(Jarek Jarcec Cecho via Kate Ting)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/67f63403
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/67f63403
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/67f63403

Branch: refs/heads/sqoop2
Commit: 67f6340344c833eae8f565347f60f37b1ac95c6d
Parents: c452ffc
Author: Kate Ting <kathleen@apache.org>
Authored: Mon May 13 00:15:13 2013 -0400
Committer: Kate Ting <kathleen@apache.org>
Committed: Mon May 13 00:15:13 2013 -0400

----------------------------------------------------------------------
 .../repository/derby/DerbySchemaConstants.java     |   78 ++++++++++++---
 .../sqoop/repository/derby/DerbySchemaQuery.java   |   62 +++++++-----
 2 files changed, 101 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/67f63403/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaConstants.java
----------------------------------------------------------------------
diff --git a/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaConstants.java
b/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaConstants.java
index e1b1128..8cdbc63 100644
--- a/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaConstants.java
+++ b/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaConstants.java
@@ -23,12 +23,14 @@ public final class DerbySchemaConstants {
 
   private static final String SCHEMA_PREFIX = SCHEMA_SQOOP + ".";
 
+  private static final String CONSTRAINT_PREFIX = "FK_";
+
   // SQ_CONNECTOR
 
   public static final String TABLE_SQ_CONNECTOR_NAME = "SQ_CONNECTOR";
 
   public static final String TABLE_SQ_CONNECTOR = SCHEMA_PREFIX
-      + TABLE_SQ_CONNECTOR_NAME;
+    + TABLE_SQ_CONNECTOR_NAME;
 
   public static final String COLUMN_SQC_ID = "SQC_ID";
 
@@ -43,7 +45,7 @@ public final class DerbySchemaConstants {
   public static final String TABLE_SQ_FORM_NAME = "SQ_FORM";
 
   public static final String TABLE_SQ_FORM = SCHEMA_PREFIX
-      + TABLE_SQ_FORM_NAME;
+    + TABLE_SQ_FORM_NAME;
 
   public static final String COLUMN_SQF_ID = "SQF_ID";
 
@@ -57,12 +59,16 @@ public final class DerbySchemaConstants {
 
   public static final String COLUMN_SQF_INDEX = "SQF_INDEX";
 
+  public static final String CONSTRAINT_SQF_SQC_NAME = CONSTRAINT_PREFIX + "SQF_SQC";
+
+  public static final String CONSTRAINT_SQF_SQC = SCHEMA_PREFIX + CONSTRAINT_SQF_SQC_NAME;
+
   // SQ_INPUT
 
   public static final String TABLE_SQ_INPUT_NAME = "SQ_INPUT";
 
   public static final String TABLE_SQ_INPUT = SCHEMA_PREFIX
-      + TABLE_SQ_INPUT_NAME;
+    + TABLE_SQ_INPUT_NAME;
 
   public static final String COLUMN_SQI_ID = "SQI_ID";
 
@@ -80,12 +86,16 @@ public final class DerbySchemaConstants {
 
   public static final String COLUMN_SQI_ENUMVALS = "SQI_ENUMVALS";
 
+  public static final String CONSTRAINT_SQI_SQF_NAME = CONSTRAINT_PREFIX + "SQI_SQF";
+
+  public static final String CONSTRAINT_SQI_SQF = SCHEMA_PREFIX + CONSTRAINT_SQI_SQF_NAME;
+
   // SQ_CONNECTION
 
   public static final String TABLE_SQ_CONNECTION_NAME = "SQ_CONNECTION";
 
   public static final String TABLE_SQ_CONNECTION = SCHEMA_PREFIX
-      + TABLE_SQ_CONNECTION_NAME;
+    + TABLE_SQ_CONNECTION_NAME;
 
   public static final String COLUMN_SQN_ID = "SQN_ID";
 
@@ -97,12 +107,16 @@ public final class DerbySchemaConstants {
 
   public static final String COLUMN_SQN_UPDATE_DATE = "SQN_UPDATE_DATE";
 
+  public static final String CONSTRAINT_SQN_SQC_NAME = CONSTRAINT_PREFIX + "SQN_SQC";
+
+  public static final String CONSTRAINT_SQN_SQC = SCHEMA_PREFIX + CONSTRAINT_SQN_SQC_NAME;
+
   // SQ_JOB
 
   public static final String TABLE_SQ_JOB_NAME = "SQ_JOB";
 
   public static final String TABLE_SQ_JOB = SCHEMA_PREFIX
-      + TABLE_SQ_JOB_NAME;
+    + TABLE_SQ_JOB_NAME;
 
   public static final String COLUMN_SQB_ID = "SQB_ID";
 
@@ -116,13 +130,17 @@ public final class DerbySchemaConstants {
 
   public static final String COLUMN_SQB_UPDATE_DATE = "SQB_UPDATE_DATE";
 
+  public static final String CONSTRAINT_SQB_SQN_NAME = CONSTRAINT_PREFIX + "SQB_SQN";
+
+  public static final String CONSTRAINT_SQB_SQN = SCHEMA_PREFIX + CONSTRAINT_SQB_SQN_NAME;
+
   // SQ_CONNECTION_INPUT
 
   public static final String TABLE_SQ_CONNECTION_INPUT_NAME =
-      "SQ_CONNECTION_INPUT";
+    "SQ_CONNECTION_INPUT";
 
   public static final String TABLE_SQ_CONNECTION_INPUT = SCHEMA_PREFIX
-      + TABLE_SQ_CONNECTION_INPUT_NAME;
+    + TABLE_SQ_CONNECTION_INPUT_NAME;
 
   public static final String COLUMN_SQNI_CONNECTION = "SQNI_CONNECTION";
 
@@ -130,10 +148,18 @@ public final class DerbySchemaConstants {
 
   public static final String COLUMN_SQNI_VALUE = "SQNI_VALUE";
 
+  public static final String CONSTRAINT_SQNI_SQN_NAME = CONSTRAINT_PREFIX + "SQNI_SQN";
+
+  public static final String CONSTRAINT_SQNI_SQN = SCHEMA_PREFIX + CONSTRAINT_SQNI_SQN_NAME;
+
+  public static final String CONSTRAINT_SQNI_SQI_NAME = CONSTRAINT_PREFIX + "SQNI_SQI";
+
+  public static final String CONSTRAINT_SQNI_SQI = SCHEMA_PREFIX + CONSTRAINT_SQNI_SQI_NAME;
+
   // SQ_JOB_INPUT
 
   public static final String TABLE_SQ_JOB_INPUT_NAME =
-      "SQ_JOB_INPUT";
+    "SQ_JOB_INPUT";
 
   public static final String TABLE_SQ_JOB_INPUT = SCHEMA_PREFIX
       + TABLE_SQ_JOB_INPUT_NAME;
@@ -144,13 +170,21 @@ public final class DerbySchemaConstants {
 
   public static final String COLUMN_SQBI_VALUE = "SQBI_VALUE";
 
+  public static final String CONSTRAINT_SQBI_SQB_NAME = CONSTRAINT_PREFIX + "SQBI_SQB";
+
+  public static final String CONSTRAINT_SQBI_SQB = SCHEMA_PREFIX + CONSTRAINT_SQBI_SQB_NAME;
+
+  public static final String CONSTRAINT_SQBI_SQI_NAME = CONSTRAINT_PREFIX + "SQBI_SQI";
+
+  public static final String CONSTRAINT_SQBI_SQI = SCHEMA_PREFIX + CONSTRAINT_SQBI_SQI_NAME;
+
   // SQ_SUBMISSION
 
   public static final String TABLE_SQ_SUBMISSION_NAME =
-      "SQ_SUBMISSION";
+    "SQ_SUBMISSION";
 
   public static final String TABLE_SQ_SUBMISSION = SCHEMA_PREFIX
-      + TABLE_SQ_SUBMISSION_NAME;
+    + TABLE_SQ_SUBMISSION_NAME;
 
   public static final String COLUMN_SQS_ID = "SQS_ID";
 
@@ -170,10 +204,14 @@ public final class DerbySchemaConstants {
 
   public static final String COLUMN_SQS_EXCEPTION_TRACE = "SQS_EXCEPTION_TRACE";
 
+  public static final String CONSTRAINT_SQS_SQB_NAME = CONSTRAINT_PREFIX + "SQS_SQB";
+
+  public static final String CONSTRAINT_SQS_SQB = SCHEMA_PREFIX + CONSTRAINT_SQS_SQB_NAME;
+
   // SQ_COUNTER_GROUP
 
   public static final String TABLE_SQ_COUNTER_GROUP_NAME =
-      "SQ_COUNTER_GROUP";
+    "SQ_COUNTER_GROUP";
 
   public static final String TABLE_SQ_COUNTER_GROUP = SCHEMA_PREFIX
       + TABLE_SQ_COUNTER_GROUP_NAME;
@@ -185,7 +223,7 @@ public final class DerbySchemaConstants {
   // SQ_COUNTER_GROUP
 
   public static final String TABLE_SQ_COUNTER_NAME =
-      "SQ_COUNTER";
+    "SQ_COUNTER";
 
   public static final String TABLE_SQ_COUNTER = SCHEMA_PREFIX
       + TABLE_SQ_COUNTER_NAME;
@@ -197,10 +235,10 @@ public final class DerbySchemaConstants {
   // SQ_COUNTER_SUBMISSION
 
   public static final String TABLE_SQ_COUNTER_SUBMISSION_NAME =
-      "SQ_COUNTER_SUBMISSION";
+    "SQ_COUNTER_SUBMISSION";
 
   public static final String TABLE_SQ_COUNTER_SUBMISSION = SCHEMA_PREFIX
-      + TABLE_SQ_COUNTER_SUBMISSION_NAME;
+    + TABLE_SQ_COUNTER_SUBMISSION_NAME;
 
   public static final String COLUMN_SQRS_GROUP = "SQRS_GROUP";
 
@@ -210,6 +248,18 @@ public final class DerbySchemaConstants {
 
   public static final String COLUMN_SQRS_VALUE = "SQRS_VALUE";
 
+  public static final String CONSTRAINT_SQRS_SQG_NAME = CONSTRAINT_PREFIX + "SQRS_SQG";
+
+  public static final String CONSTRAINT_SQRS_SQG = SCHEMA_PREFIX + CONSTRAINT_SQRS_SQG_NAME;
+
+  public static final String CONSTRAINT_SQRS_SQR_NAME = CONSTRAINT_PREFIX + "SQRS_SQR";
+
+  public static final String CONSTRAINT_SQRS_SQR = SCHEMA_PREFIX + CONSTRAINT_SQRS_SQR_NAME;
+
+  public static final String CONSTRAINT_SQRS_SQS_NAME = CONSTRAINT_PREFIX + "SQRS_SQS";
+
+  public static final String CONSTRAINT_SQRS_SQS = SCHEMA_PREFIX + CONSTRAINT_SQRS_SQS_NAME;
+
   private DerbySchemaConstants() {
     // Disable explicit object creation
   }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/67f63403/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaQuery.java
----------------------------------------------------------------------
diff --git a/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaQuery.java
b/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaQuery.java
index 24f86ee..c8ce3aa 100644
--- a/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaQuery.java
+++ b/repository/repository-derby/src/main/java/org/apache/sqoop/repository/derby/DerbySchemaQuery.java
@@ -203,8 +203,9 @@ public final class DerbySchemaQuery {
       + COLUMN_SQF_NAME + " VARCHAR(64), "
       + COLUMN_SQF_TYPE + " VARCHAR(32), "
       + COLUMN_SQF_INDEX + " SMALLINT, "
-      + " FOREIGN KEY (" + COLUMN_SQF_CONNECTOR+ ")"
-        + " REFERENCES " + TABLE_SQ_CONNECTOR + " (" + COLUMN_SQC_ID + ")"
+      + "CONSTRAINT " + CONSTRAINT_SQF_SQC + " "
+        + "FOREIGN KEY (" + COLUMN_SQF_CONNECTOR + ") "
+          + "REFERENCES " + TABLE_SQ_CONNECTOR + " (" + COLUMN_SQC_ID + ")"
       + ")";
 
   // DDL: Create table SQ_INPUT
@@ -218,8 +219,9 @@ public final class DerbySchemaQuery {
       + COLUMN_SQI_STRMASK + " BOOLEAN, "
       + COLUMN_SQI_STRLENGTH + " SMALLINT, "
       + COLUMN_SQI_ENUMVALS + " VARCHAR(100),"
-      + " FOREIGN KEY (" + COLUMN_SQI_FORM + ")"
-        + " REFERENCES " + TABLE_SQ_FORM + " (" + COLUMN_SQF_ID + ")"
+      + "CONSTRAINT " + CONSTRAINT_SQI_SQF + " "
+        + "FOREIGN KEY (" + COLUMN_SQI_FORM + ") "
+          + "REFERENCES " + TABLE_SQ_FORM + " (" + COLUMN_SQF_ID + ")"
       + ")";
 
   // DDL: Create table SQ_CONNECTION
@@ -230,8 +232,9 @@ public final class DerbySchemaQuery {
       + COLUMN_SQN_NAME  + " VARCHAR(32),"
       + COLUMN_SQN_CREATION_DATE + " TIMESTAMP,"
       + COLUMN_SQN_UPDATE_DATE + " TIMESTAMP,"
-      + " FOREIGN KEY(" + COLUMN_SQN_CONNECTOR + ")"
-        + " REFERENCES " + TABLE_SQ_CONNECTOR + " (" + COLUMN_SQC_ID + ")"
+      + "CONSTRAINT " + CONSTRAINT_SQN_SQC + " "
+        + "FOREIGN KEY(" + COLUMN_SQN_CONNECTOR + ") "
+          + " REFERENCES " + TABLE_SQ_CONNECTOR + " (" + COLUMN_SQC_ID + ")"
       + ")";
 
   // DDL: Create table SQ_JOB
@@ -243,8 +246,9 @@ public final class DerbySchemaQuery {
       + COLUMN_SQB_TYPE + " VARCHAR(64),"
       + COLUMN_SQB_CREATION_DATE + " TIMESTAMP,"
       + COLUMN_SQB_UPDATE_DATE + " TIMESTAMP,"
-      + " FOREIGN KEY(" + COLUMN_SQB_CONNECTION + ")"
-        + " REFERENCES " + TABLE_SQ_CONNECTION + " (" + COLUMN_SQN_ID + ")"
+      + "CONSTRAINT " + CONSTRAINT_SQB_SQN + " "
+        + "FOREIGN KEY(" + COLUMN_SQB_CONNECTION + ") "
+          + "REFERENCES " + TABLE_SQ_CONNECTION + " (" + COLUMN_SQN_ID + ")"
       + ")";
 
   // DDL: Create table SQ_CONNECTION_INPUT
@@ -253,11 +257,13 @@ public final class DerbySchemaQuery {
       + COLUMN_SQNI_CONNECTION + " BIGINT, "
       + COLUMN_SQNI_INPUT + " BIGINT, "
       + COLUMN_SQNI_VALUE + " LONG VARCHAR,"
-      + " PRIMARY KEY (" + COLUMN_SQNI_CONNECTION + ", " + COLUMN_SQNI_INPUT + "),"
-      + " FOREIGN KEY (" + COLUMN_SQNI_CONNECTION + ")"
-        + " REFERENCES " + TABLE_SQ_CONNECTION + " (" + COLUMN_SQN_ID + "),"
-      + " FOREIGN KEY (" + COLUMN_SQNI_INPUT + ")"
-        + " REFERENCES " + TABLE_SQ_INPUT + " (" + COLUMN_SQI_ID + ")"
+      + "PRIMARY KEY (" + COLUMN_SQNI_CONNECTION + ", " + COLUMN_SQNI_INPUT + "), "
+      + "CONSTRAINT " + CONSTRAINT_SQNI_SQN + " "
+        + "FOREIGN KEY (" + COLUMN_SQNI_CONNECTION + ") "
+          + "REFERENCES " + TABLE_SQ_CONNECTION + " (" + COLUMN_SQN_ID + "),"
+      + "CONSTRAINT " + CONSTRAINT_SQNI_SQI + " "
+        + "FOREIGN KEY (" + COLUMN_SQNI_INPUT + ") "
+          + "REFERENCES " + TABLE_SQ_INPUT + " (" + COLUMN_SQI_ID + ")"
       + ")";
 
   // DDL: Create table SQ_JOB_INPUT
@@ -267,10 +273,12 @@ public final class DerbySchemaQuery {
       + COLUMN_SQBI_INPUT + " BIGINT, "
       + COLUMN_SQBI_VALUE + " LONG VARCHAR,"
       + " PRIMARY KEY (" + COLUMN_SQBI_JOB + ", " + COLUMN_SQBI_INPUT + "), "
-      + " FOREIGN KEY (" + COLUMN_SQBI_JOB + ")"
-        + " REFERENCES " + TABLE_SQ_JOB + " (" + COLUMN_SQB_ID + "), "
-      + " FOREIGN KEY (" + COLUMN_SQBI_INPUT + ")"
-        + " REFERENCES " + TABLE_SQ_INPUT + " (" + COLUMN_SQI_ID + ")"
+      + " CONSTRAINT " + CONSTRAINT_SQBI_SQB + " "
+        + "FOREIGN KEY (" + COLUMN_SQBI_JOB + ") "
+        +  "REFERENCES " + TABLE_SQ_JOB + " (" + COLUMN_SQB_ID + "), "
+      + " CONSTRAINT " + CONSTRAINT_SQBI_SQI + " "
+        + "FOREIGN KEY (" + COLUMN_SQBI_INPUT + ") "
+          + "REFERENCES " + TABLE_SQ_INPUT + " (" + COLUMN_SQI_ID + ")"
       + ")";
 
   // DDL: Create table SQ_SUBMISSION
@@ -286,8 +294,9 @@ public final class DerbySchemaQuery {
     + COLUMN_SQS_EXCEPTION + " VARCHAR(150), "
     + COLUMN_SQS_EXCEPTION_TRACE + " VARCHAR(750), "
     + "PRIMARY KEY (" + COLUMN_SQS_ID + "), "
-    + "FOREIGN KEY (" + COLUMN_SQS_JOB + ")"
-      + " REFERENCES " + TABLE_SQ_JOB + "("  + COLUMN_SQB_ID + ") ON DELETE CASCADE"
+    + "CONSTRAINT " + CONSTRAINT_SQS_SQB + " "
+      + "FOREIGN KEY (" + COLUMN_SQS_JOB + ") "
+        + "REFERENCES " + TABLE_SQ_JOB + "("  + COLUMN_SQB_ID + ") ON DELETE CASCADE"
     +  ")";
 
   // DDL: Create table SQ_COUNTER_GROUP
@@ -316,12 +325,15 @@ public final class DerbySchemaQuery {
     + COLUMN_SQRS_SUBMISSION + " BIGINT, "
     + COLUMN_SQRS_VALUE + " BIGINT, "
     + "PRIMARY KEY (" + COLUMN_SQRS_GROUP + ", " + COLUMN_SQRS_COUNTER + ", " + COLUMN_SQRS_SUBMISSION
+ "), "
-    + "FOREIGN KEY (" + COLUMN_SQRS_GROUP + ")"
-      + " REFERENCES " + TABLE_SQ_COUNTER_GROUP + "(" + COLUMN_SQG_ID + "), "
-    + "FOREIGN KEY (" + COLUMN_SQRS_COUNTER + ")"
-      + " REFERENCES " + TABLE_SQ_COUNTER + "(" + COLUMN_SQR_ID + "), "
-    + "FOREIGN KEY (" + COLUMN_SQRS_SUBMISSION + ")"
-      + " REFERENCES " + TABLE_SQ_SUBMISSION + "(" + COLUMN_SQS_ID + ") ON DELETE CASCADE
"
+    + "CONSTRAINT " + CONSTRAINT_SQRS_SQG + " "
+      + "FOREIGN KEY (" + COLUMN_SQRS_GROUP + ") "
+        + "REFERENCES " + TABLE_SQ_COUNTER_GROUP + "(" + COLUMN_SQG_ID + "), "
+    + "CONSTRAINT " + CONSTRAINT_SQRS_SQR + " "
+      + "FOREIGN KEY (" + COLUMN_SQRS_COUNTER + ") "
+        + "REFERENCES " + TABLE_SQ_COUNTER + "(" + COLUMN_SQR_ID + "), "
+    + "CONSTRAINT " + CONSTRAINT_SQRS_SQS + " "
+      + "FOREIGN KEY (" + COLUMN_SQRS_SUBMISSION + ") "
+        + "REFERENCES " + TABLE_SQ_SUBMISSION + "(" + COLUMN_SQS_ID + ") ON DELETE CASCADE
"
     + ")";
 
   // DML: Fetch connector Given Name


Mime
View raw message