-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delete feed from RDBMS #134
Conversation
This also updates the documentation of the command line features.
…leting record) This is a breaking change in that it requires any existing SQL database for gtfs-lib to add the feeds#deleted boolean column. BREAKING CHANGE
Codecov Report
@@ Coverage Diff @@
## dev #134 +/- ##
============================================
- Coverage 48.62% 48.38% -0.24%
- Complexity 595 596 +1
============================================
Files 142 142
Lines 6974 7023 +49
Branches 809 817 +8
============================================
+ Hits 3391 3398 +7
- Misses 3279 3320 +41
- Partials 304 305 +1
Continue to review full report at Codecov.
|
printHelp(options); | ||
return; | ||
} | ||
|
||
boolean storeResults = cmd.hasOption("json"); | ||
File directory = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move the creation of the objectMapper down here, conditional upon storeResults=true.
|
||
if (namespaceToDelete != null) { | ||
LOG.info("Exporting feed with unique identifier {}", namespaceToDelete); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Message appears to be incorrect.
@@ -252,7 +324,7 @@ private static Options getOptions () { | |||
.desc("zip file path for the exported GTFS").build()); | |||
options.addOption(Option.builder().longOpt("load").hasArg() | |||
.argName("file").desc("load GTFS data from the given file").build()); | |||
options.addOption(Option.builder().longOpt("validate").hasArg().optionalArg(true).argName("feed") | |||
options.addOption(Option.builder().longOpt("validate").hasArg().optionalArg(true).argName("feedId") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"feedId" has another meaning distinct from our unique-IDs for loaded feed versions ("namespaces"). We should probably avoid use of the word feedId.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would agree with that. However, it has been used in a number of places within this class already to mean namespace
often with a parenthetical clarifying that it is referring to the schema identifier. This would actually be a breaking change -- so could we just clarify the meaning in the cmd line option description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't necessarily think that we should change this right away, now that I see how many times the word feedId is used in this class. But I don't see why it would be a breaking change. The validate tasks's argument is called feed
rather than feedId
so the command line options are already a bit incoherent. But I don't even think the argument names are used anywhere. We'd want to also change some parameter names, but since parameters are positional in Java it wouldn't break callers.
I will make a ticket for this if we're not going to change it soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you're right. Changing the name feedId
wouldn't affect any command line instructions, just the output of the help text. I will update these arg names here and we can use the ticket you create to track down/update other inconsistent usages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like there were no changes to the use of the term "feedId", was this an intentional decision to continue using the term? Is it used in this sense elsewhere in the user-facing usage messages?
@@ -179,8 +179,8 @@ public static DataSource createDataSource (String url, String username, String p | |||
* It also lets you run a GraphQL API for all the feeds loaded into the database. | |||
*/ | |||
public static void main (String[] args) throws IOException { | |||
// Object mapper used for writing load or validation results to file. | |||
ObjectMapper mapper = new ObjectMapper(); | |||
// Object mapper used for writing load or validation results to file (instantia). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There appears to be stray text in this comment. This is a detail, but I'd find the code easier to read if the variable were declared and initialized to null just before it is conditionally set to a new instance, around line 211 where we also declare File directory = null;
@abyrd, I hadn't changed anything related to the use of |
Oh, didn't see that comment before. I just replied. We can always do it later, maybe just make an issue to clean this up later. |
I'm going to go ahead and merge this. I've created a ticket to track the namespace/feedId conflation issue here: #142. |
🎉 This PR is included in version 4.1.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This PR adds the ability to delete a feed (essentially dropping a schema) to the RDBMS-backed code path.
It also updates the documentation for the cmd line interface (in addition to adding the
--delete
and--json
options).Finally, it tweaks the
TableLoadResult
andFeedLoadResult
objects to include fields forfileSize
andfilename
, respectively.