From 3d2b62be55f910f34b75be91fe8ea2307a08205c Mon Sep 17 00:00:00 2001 From: ayn leslie Date: Fri, 19 Sep 2014 12:41:35 -0700 Subject: [PATCH] Added a -v, --version flag to get the version of the DataSync jar being run. Removed the resource name from schemas on port jobs so they don't fail. Reviewed-by: franklin --- src/main/java/com/socrata/datasync/Main.java | 2 ++ src/main/java/com/socrata/datasync/PortUtility.java | 3 +++ .../java/com/socrata/datasync/config/CommandLineOptions.java | 1 + 3 files changed, 6 insertions(+) diff --git a/src/main/java/com/socrata/datasync/Main.java b/src/main/java/com/socrata/datasync/Main.java index a13e4298..f6d9f143 100644 --- a/src/main/java/com/socrata/datasync/Main.java +++ b/src/main/java/com/socrata/datasync/Main.java @@ -31,6 +31,8 @@ public static void main(String[] args) throws ParseException { } else if(args.length == 1) { if(args[0].equals("-?") || args[0].equals("--help")) { printHelp(); + } else if (args[0].equals("-v") || args[0].equals("--version")) { + System.out.println("DataSync version " + VersionProvider.getThisVersion()); } else { // Run a job file (.sij) in command-line mode String jobFileToRun = args[0]; diff --git a/src/main/java/com/socrata/datasync/PortUtility.java b/src/main/java/com/socrata/datasync/PortUtility.java index 41e394bb..3b2660d6 100644 --- a/src/main/java/com/socrata/datasync/PortUtility.java +++ b/src/main/java/com/socrata/datasync/PortUtility.java @@ -175,9 +175,12 @@ public static JobStatus assertSchemasAreAlike(SodaDdl sourceChecker, SodaDdl sin * with a grouping_aggregrate but no group-by). The editing of the field name is necessary for subsequent * data loading, since the data from soda2 expectst aggregated columns to include the grouping_aggregate. * Also removes drill-down formatting info, as this is non-sensical without the unaggregated data + * Also removing the resourceName - no port job can succeed with one present. * @param schema the Dataset from soda-java representing the schema */ public static void adaptSchemaForAggregates(Dataset schema) { + // TODO: give users the option to choose a new resource name; in the meanwhile, it can be set after the job completes + schema.setResourceName(null); List columns = schema.getColumns(); for (int i = 0; i < columns.size(); i++) { Column col = columns.get(i); diff --git a/src/main/java/com/socrata/datasync/config/CommandLineOptions.java b/src/main/java/com/socrata/datasync/config/CommandLineOptions.java index 54c7d8c7..3abd1ef5 100644 --- a/src/main/java/com/socrata/datasync/config/CommandLineOptions.java +++ b/src/main/java/com/socrata/datasync/config/CommandLineOptions.java @@ -74,6 +74,7 @@ public class CommandLineOptions { options.addOption("pdt", DESTINATION_DATASET_TITLE_FLAG, true, "Destination Dataset Title (optional) [PortJob]"); options.addOption("?", "help", false, "Help"); + options.addOption("v", "version", false, "DataSync version"); } public static CommandLine getCommandLine(String[] args) throws ParseException, ParseException {