databricks-cli icon indicating copy to clipboard operation
databricks-cli copied to clipboard

Add "workspace export_any" command

Open jric opened this issue 7 years ago • 5 comments

I propose to add an additional option to workspace so that the user doesn't need to know which type of object exists at the given path. When executing a "workspace ls" it is difficult to tell which type of object it is programmatically (without spoofing a color console and parsing the color codes.) It looks like "workspace export" will fail on a directory and "workspace export_dir" will fail on a non-directory, so neither command is a surefire way to export a given path. I propose to add "export_any" which will call one of the two above functions as appropriate, given the path.

jric avatar Nov 13 '17 19:11 jric

Nevermind. Reading through the code I just found the "-l" option to the "ls" command. I now propose adding doc about this option to the README.rst. I'll make a PR.

jric avatar Nov 13 '17 20:11 jric

Addressed with PR#54.

jric avatar Nov 13 '17 20:11 jric

Actually, I don't think this is going to solve the problem, because the output is written "space" separated, rather than tab-separated, using tabulate library. The issue is that it will be error-prone to try to parse that, since many object-names have spaces in them. I propose to switch to "tab" separated, or add an option to do so.

jric avatar Nov 13 '17 22:11 jric

Unfortunately it's hard to get alignment right with tab delimiters. ls -l will use space delimiters too. Would a new output format called --json work better? That way you can parse the json output directly with something like jq.

andrewmchen avatar Nov 14 '17 07:11 andrewmchen

Yes, that would be a great option. No urgency on this idea for now.... I'm experimenting with working directly with the REST API.

jric avatar Nov 14 '17 16:11 jric