Skip to content

CLI for interacting with aperturedb - #249

Merged
gsaluja9 merged 24 commits into
developfrom
feature/cli
Jul 27, 2023
Merged

gsaluja9 merged 24 commits into
developfrom
feature/cli

Conversation

@gsaluja9

@gsaluja9 gsaluja9 commented Jun 26, 2023 •

Copy link
Copy Markdown
Contributor

This provides a few of commonly repeated scripts

  • like generating queries from CSVs.
  • Testing connectivity.
  • Managing multiple connections for aperturedb instances through cli.

Additionally, not being based on getopt, it has features like bash auto completion, and richer console io.

The most important bit that it provides would be to not have configuration put in as code, use connections across projects (if required).

@gsaluja9
gsaluja9 marked this pull request as draft June 29, 2023 15:01
@gsaluja9
gsaluja9 requested review from drewaogle and luisremis July 7, 2023 21:36
* Ingest command.

* Some cleanup and utils.
@gsaluja9
gsaluja9 requested a review from bovlb July 10, 2023 17:14
@gsaluja9
gsaluja9 marked this pull request as ready for review July 10, 2023 17:52
Comment thread .gitignore Resolved
Comment thread aperturedb/cli/utilities.py Resolved


@app.command()
def from_json_file(filepath: str):

@luisremis luisremis Jul 18, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the use case of creating indexes that I mentioned, we can just put the query on a .json file and use this. Neat.

I am still unsure what should go on Python scripts and what to move to bash. I think we will learn over time, but if you have an idea, a Readme with your practices to learn from would be good.

Comment thread aperturedb/Utils.py Resolved
Comment thread aperturedb/__init__.py Resolved
luisremis
luisremis previously approved these changes Jul 18, 2023
Comment thread aperturedb/cli/adb.py Resolved
Comment thread aperturedb/cli/ingest.py Resolved
@gsaluja9
gsaluja9 requested review from drewaogle and luisremis July 25, 2023 16:56
from aperturedb.Configuration import Configuration


class ObjEncoder(JSONEncoder):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to have a explanation of this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will put the comment.

Comment thread aperturedb/cli/ingest.py Outdated
Comment on lines +55 to +56
from aperturedb.cli.console import console
console.log(db)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nicer to have the import at top, is there a reason it is here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no will adjust that.

Comment thread test/generateInput.py

multiplier = multiplier // 2
path = "input/images/"
path = "images/"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I liked having a separate "input" directory where the csv was and the the images were below, as were blobs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still going to end up there. The problem was that the path was relative to the cwd of the running code. With adb, you can run it from arbitrary folder, adjusting the CLI path.

This change mostly sets the image path relative to the csv path, and the DataCSV treats it as such.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, this should be applicable to anything having blobs. I will update the Video and Blobs too.

@luisremis luisremis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! I think we should addressed this before merging, but it is ok to create an Issue on it and fix it in a subsequent PR if it will be addressed soon. it is scary to be 1 tab away from deleting data.

@gsaluja9
gsaluja9 merged commit 69ef22d into develop Jul 27, 2023
@gsaluja9
gsaluja9 deleted the feature/cli branch July 27, 2023 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants