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

FTP/SFTP support for loading data (JSON, CSV, XML) #292

Closed
aethant opened this issue Feb 22, 2017 · 4 comments
Closed

FTP/SFTP support for loading data (JSON, CSV, XML) #292

aethant opened this issue Feb 22, 2017 · 4 comments
Assignees

Comments

@aethant
Copy link

aethant commented Feb 22, 2017

Not sure whether this is a bug report, or a feature request or a request for clarification - is it possible to do an apoc.load call, using FTP/SFTP as a url? If so, how would you pass in the username and password?

I'm not really fluent in Java to delve into the code myself, but I'd imagine the underlying mechanics would involve opening the stream and reading it, just like any other file. Perhaps username and password could be passed in with the options object, just like the separator?

If it is currently possible, can someone point me in the right direction of how? If not, can I please officially request support for this? It'd save like 3 steps on a project I'm currently working on.

@abhishekunotech
Copy link

@aethant : If you do want to delve into the Java of this, Current implementation of apoc.load eventually traces back to creation of a HTTPClient Instance in Java using the URL you pass to apoc.load()...,

You can use an FTPClient instance of Java, in its place, if you have the resources to implement that and re-compile APOC locally.

@sarmbruster
Copy link
Contributor

I think it should be easy to change https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/3.1/src/main/java/apoc/export/util/FileUtils.java#L18 to also check for ftp. By default the JVM does have URLStreamHandlers for http, https and ftp aboard. For any other protocols it is possible to supply additional URLStreamHandlers to the JVM, see https://docs.oracle.com/javase/8/docs/api/java/net/URL.html#URL-java.lang.String-java.lang.String-int-java.lang.String-

I think it's actually a good idea to change apoc code to be agnostic of url schemes and leave it up to the JVM if it can be loaded or not.

@abhishekunotech
Copy link

@sarmbruster, it will still require changes at https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/3.1/src/main/java/apoc/util/Util.java#L223, to create Clients specific to protocol.

It might require a bit more than a simple patch, to rework the requests to be url-scheme agnostic.

But, I see where you would want to go with it.

@jexp
Copy link
Member

jexp commented Jun 29, 2017

FTP at least should be easy to check via ftp:// URLs
Not sure about URL-Handlers for sftp

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

No branches or pull requests

6 participants