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

[FEAT] init sql using command line args #1437

Merged
merged 8 commits into from
Aug 16, 2022

Conversation

metemaddar
Copy link
Contributor

@metemaddar metemaddar commented Aug 14, 2022

  • python src/db/sql/init_sql.py upgrade/downgrade functions/triggers
  • eg: python src/db/sql/init_sql.py upgrade functions

Description

  • Add command line argument parser to init_sql
  • Add report function to init_sql

Motivation and Context

  • Now we don't need to change the init_sql in order to run the upgrade/downgrade functions/triggers
  • Report how database functions/triggers look like in database compared to their sql files.

How Has This Been Tested?

Manually tested

Screenshots (if appropriate):

root@goat_api:/app# python src/db/sql/init_sql.py -h
usage: init_sql.py [-h] [--material {functions,triggers}] {upgrade,downgrade,report}

Upgrade and Downgrade sql functions and triggers

positional arguments:
  {upgrade,downgrade,report}
                        The action to do on database

optional arguments:
  -h, --help            show this help message and exit
  --material {functions,triggers}, -m {functions,triggers}
                        functions or triggers

example usage:
    cd /app
    python src/db/sql/init_sql.py upgrade -m functions
    python src/db/sql/init_sql.py downgrade -m triggers
    python src/db/sql/init_sql.py report

Related Issue

#1368

@metemaddar metemaddar marked this pull request as ready for review August 15, 2022 15:48
@metemaddar metemaddar requested a review from EPajares August 15, 2022 15:49
classified_functions[directory_name].append(file_name)

for key in classified_functions.keys():
print("##", key + "/")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I have once written some very basic functions for printing INFO or WARNING. Maybe you want to use the. You can find them here: https://github.com/goat-community/goat/blob/dev/app/api/src/utils.py

Copy link
Contributor Author

Choose a reason for hiding this comment

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

✔️ Done some basics as well 😄
Screenshot from 2022-08-16 00-58-14

@EPajares EPajares merged commit e3d6ae5 into goat-community:dev Aug 16, 2022
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.

2 participants