Augmented scripts are useful for testing updates that require large amounts of data change, such as updating thousands of rows related to client payment information when a client transitions to a new API, and require various developers to review queries, which helps cut down the chance of errors. Plus, with augmented scripts, engineers can save and copy revert queries to use in case they need to make any changes after the query runs.
Database transaction scripts are optimal for data maintenance and organization. The query includes information about specific transactions, such as the creator’s name, client name(s), the associated ticket number (Jira, Zendesk), and what the transaction achieves. Since the original PR contains all conversations related to the query, all necessary information is centralized. After a query’s PR is closed, engineers can easily search for it by date in GitHub.
Note: Queries created using this method aren’t merged. Instead, they’re closed as soon as the scripts run; otherwise, the folder containing these scripts would become too large and unmanageable over time.
To run the query:
- Navigate to your local container.
- In your local container, type the bin britecore_shell.py
- Type help > developer
- Type help > query_scripts
- Type the applicable information for the following prompts:
- Enter your name
- Enter the client(s) to run query on
- Enter what this transaction will (do)
Example: update every user to be John Smith
- Enter the associated ticket
Example: zendesk 1111
- Press Enter then paste your query
- Enter a select version of your query
Note: This allows you to see all the data that will be changed before you make the changes.
- Enter Y for “Can this query be reverted?”
- Press Enter to input your revert query
- Enter Y to have a select version
- A new query script is created
- In your text editor, open the query_scripts folder, and then, select the query you created.
- Create a PR containing the new file.
- Ask another developer to review the query to ensure it produces the expected results.
- Run the select query in MySQL or RunDeck.
- Close the PR.
Important: Don’t merge.
For more information, read PR 11108.