Skip to content
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

Merged
merged 17 commits into from
Sep 17, 2018
Merged

Delete feed from RDBMS #134

merged 17 commits into from
Sep 17, 2018

Conversation

landonreed
Copy link
Contributor

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 and FeedLoadResult objects to include fields for fileSize and filename, respectively.

@landonreed landonreed requested a review from abyrd August 28, 2018 16:02
…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-io
Copy link

codecov-io commented Aug 28, 2018

Codecov Report

Merging #134 into dev will decrease coverage by 0.23%.
The diff coverage is 22.58%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
...java/com/conveyal/gtfs/loader/TableLoadResult.java 100% <ø> (ø) 1 <0> (ø) ⬇️
...onveyal/gtfs/validator/PatternFinderValidator.java 85.36% <ø> (ø) 9 <0> (ø) ⬇️
.../java/com/conveyal/gtfs/loader/FeedLoadResult.java 100% <ø> (ø) 2 <0> (ø) ⬇️
...in/java/com/conveyal/gtfs/graphql/GTFSGraphQL.java 66.66% <100%> (+4.16%) 3 <0> (ø) ⬇️
src/main/java/com/conveyal/gtfs/GTFS.java 40.11% <14.54%> (-12.3%) 9 <2> (ø)
.../java/com/conveyal/gtfs/loader/JdbcGtfsLoader.java 63.11% <80%> (+0.38%) 20 <1> (+1) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4069ccd...75200e9. Read the comment docs.

printHelp(options);
return;
}

boolean storeResults = cmd.hasOption("json");
File directory = null;
Copy link
Member

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);
Copy link
Member

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")
Copy link
Member

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.

Copy link
Contributor Author

@landonreed landonreed Sep 11, 2018

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?

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

@abyrd abyrd left a 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).
Copy link
Member

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;

@landonreed
Copy link
Contributor Author

@abyrd, I hadn't changed anything related to the use of feedId because I was awaiting a response to the above comment: #134 (comment).

@abyrd
Copy link
Member

abyrd commented Sep 13, 2018

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.

@landonreed
Copy link
Contributor Author

I'm going to go ahead and merge this. I've created a ticket to track the namespace/feedId conflation issue here: #142.

@landonreed landonreed merged commit f98abe5 into dev Sep 17, 2018
@landonreed landonreed deleted the delete-feed branch September 17, 2018 20:11
@landonreed
Copy link
Contributor Author

🎉 This PR is included in version 4.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants