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

Simplify and reorder parameters to catalog/pgcli recipe #2023

Merged
merged 2 commits into from
May 5, 2023

Conversation

AetherUnbound
Copy link
Collaborator

@AetherUnbound AetherUnbound commented May 4, 2023

Description

This PR adjust the recipe for catalog/pgcli to reduce the number of overrides necessary to define when switching between the Airflow and upstream databases. Additionally, I've reordered the parameters (since with just you have to override all parameters in order if you want to change one) so that the fewest need to be changed. Our username and passwords are the same for both databases so I just combined the field.

Lastly, the current config actually didn't work because it was using the airflow creds to connect to the upstream database (which it didn't have access to). I can only speak from personal experience, but almost every time I use the pgcli command for the catalog it's to access the upstream database, so I changed the default to be that.

Update: Based on feedback below, I've combined the recipes into a _pgcli recipe at the root level, which both the API and catalog now call.

Testing Instructions

  1. On main, running j catalog/pgcli and then select * from image limit 10 should raise an error
  2. Repeating the above on this branch should return results (if they exist)!
  3. Try running j catalog/pgcli airflow airflow and run \d and various selects to ensure you can see the airflow schema
  4. Run j api/pgcli and confirm that this correctly connects to the API's database and can be used to query the API as well.

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • I ran the DAG documentation generator (if applicable).

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@AetherUnbound AetherUnbound requested a review from a team as a code owner May 4, 2023 01:09
@AetherUnbound AetherUnbound added 🟩 priority: low Low priority and doesn't need to be rushed 🛠 goal: fix Bug fix 🤖 aspect: dx Concerns developers' experience with the codebase 🧱 stack: catalog Related to the catalog and Airflow DAGs labels May 4, 2023
Copy link
Collaborator

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

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

LGTM.

It may be best to even move this recipe up to the root file considering both databases are shared across multiple apps. just api/dbshell will get you the API database.

Something like just dbshell catalog and just dbshell api would be pretty handy!

Copy link
Member

@dhruvkb dhruvkb left a comment

Choose a reason for hiding this comment

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

I was under the impression that the host and port were the parameters most often to change, but I haven't used this recipe enough to know.
Since the api also has a pgcli recipe could you copy the same changes over there?

@sarayourfriend's suggestion to have a pgcli recipe in the root makes sense, considering they have the same basic structure (and they both ultimately use ../exec recipe from the root justfile anyway).

But I'd still prefer to retain the recipes api/pgcli and catalog/pgcli (that call the root pgcli with the right defaults) to keep with the <project>/<recipe> convention instead of the <recipe> <project> convention (that I've seen in the infra repo).

Screenshot 2023-05-04 at 10 49 28 AM

@AetherUnbound
Copy link
Collaborator Author

Great call with both suggestions! I'll set up a common recipe at the top level, but then use it in api/pgcli and catalog/pgcli with the defaults modified in this PR.

@github-actions github-actions bot added the 🧱 stack: api Related to the Django API label May 4, 2023
@AetherUnbound
Copy link
Collaborator Author

@dhruvkb and @sarayourfriend - I've combined recipes where possible, how does this look?

Copy link
Collaborator

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

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

Right on!

@AetherUnbound AetherUnbound merged commit e78b0bc into main May 5, 2023
@AetherUnbound AetherUnbound deleted the feature/catalog-pgcli-just-recipe-improvement branch May 5, 2023 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 aspect: dx Concerns developers' experience with the codebase 🛠 goal: fix Bug fix 🟩 priority: low Low priority and doesn't need to be rushed 🧱 stack: api Related to the Django API 🧱 stack: catalog Related to the catalog and Airflow DAGs
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants