From 00d7c89ef6856acd6f67172e481286990be715b6 Mon Sep 17 00:00:00 2001 From: avisionh Date: Mon, 24 May 2021 08:34:27 +0100 Subject: [PATCH 1/5] docs: Hide instructions relating to env variable setting This is because it's not currently being used but may be used later. --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 074cef6..77c3c34 100644 --- a/README.md +++ b/README.md @@ -11,14 +11,15 @@ Currently, we implement the ability of representing how each of the tables in a ## Requirements To run the code in here, ensure your system meets the following requirements: -- Unix-like operating system (macOS, Linux, ...); -- [`direnv`](https://direnv.net/) installed, including shell hooks; -- [`.envrc`](https://github.com/avisionh/sqlquerygraph/blob/main/.envrc) allowed/trusted by `direnv` to - use the environment variables - see [below](#allowingtrusting-envrc); +- Unix-like operating system (macOS, Linux, ...) - though it might work on Windows; - Python 3.8 or above; and - [Poetry](https://python-poetry.org/docs/) installed. + -Note there may be some Python IDE-specific requirements around loading environment variables, which are not considered here. + ### Set-up For quickstart set-up of the project, run the below in your shell/terminal: From 16d0197199d5bb616e0324f75e479c11b8093d9a Mon Sep 17 00:00:00 2001 From: avisionh Date: Mon, 24 May 2021 09:23:40 +0100 Subject: [PATCH 2/5] docs: Specify additional arguments for module This is so users are aware that they can customise it further. --- guide/module.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 guide/module.md diff --git a/guide/module.md b/guide/module.md new file mode 100644 index 0000000..dc9ae75 --- /dev/null +++ b/guide/module.md @@ -0,0 +1,14 @@ +### Module arguments +In the Python module example run to extract and export to `.csv` the table names and dependencies of `.sql` scripts: +```shell script +python sqlquerygraph.py -sd 'sql' -ed 'neo4j' -rd 'github_repos' 'analytics' 'reporting' +``` +More arguments can be specified to provide greater customisation. They are: + +| Argument - short | Argument - long | Description | Required | +|------------------|-----------------|-------------| -------- | +| `-sd` | `--script_dir` | Directory where we store subdirectories of our SQL queries. | True | +| `-d` | `--sub_dir` | Subdirectories within script_dir that you want to read SQL queries from. If no value is inputted, then use all subdirectories in script_dir. | False | +| `-rd` | `--reference_datasets` | Datasets that contain tables in database to look-up against. | True | +| `-ed` | `--export_dir` | Directory to store files. | True | +| `-v` | `--verbose` | Boolean to output steps taken and query after cleaning. Useful if want to check where function is failing. If no value is inputted, then it is False. " | False | From 63b784635f0e513dd0d53e9dd56f243ece48fb34 Mon Sep 17 00:00:00 2001 From: avisionh Date: Mon, 24 May 2021 09:50:10 +0100 Subject: [PATCH 3/5] chore: Establish auth on neo4j set-up This is so this can be explicit when deploying to production. --- docker-compose.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f12c8f4..03e5de4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,7 +14,9 @@ services: - ./logs:/logs - ./plugins:/plugins environment: + NEO4j_dbms.security.auth_enabled: 'true' + NEO4j_AUTH: 'neo4j/neo4j' # Raise memory limits - - NEO4J_dbms_memory_pagecache_size=2G - - NEO4J_dbms.memory.heap.initial_size=2G - - NEO4J_dbms_memory_heap_max__size=2G + NEO4J_dbms_memory_pagecache_size: 2G + NEO4J_dbms.memory.heap.initial_size: 2G + NEO4J_dbms_memory_heap_max__size: 2G From 16ad384b42c6cf9c3c39baa3e1b3379b36dd7d56 Mon Sep 17 00:00:00 2001 From: avisionh Date: Mon, 24 May 2021 11:51:29 +0100 Subject: [PATCH 4/5] docs: Write CODE_OF_CONDUCT This is so we can set standards. --- .github/CODE_OF_CONDUCT.md | 127 ++++++++++++++++++ .github/CONTRIBUTING.md | 0 ...t_template.md => PULL_REQUEST_TEMPLATE.md} | 0 README.md | 9 +- 4 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 .github/CODE_OF_CONDUCT.md create mode 100644 .github/CONTRIBUTING.md rename .github/{pull_request_template.md => PULL_REQUEST_TEMPLATE.md} (100%) diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..ddc6a8a --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,127 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, +and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall +community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or +advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email +address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a +professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards +of acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies +when an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at **a_vision@hotmail.co.uk**. All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, +available at https://www.contributor-covenant.org/version/2/0/ +code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at https:// +www.contributor-covenant.org/translations. diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..e69de29 diff --git a/.github/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from .github/pull_request_template.md rename to .github/PULL_REQUEST_TEMPLATE.md diff --git a/README.md b/README.md index 77c3c34..e6f7a52 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,14 @@ We use [neo4j](https://neo4j.com/) for this project to visualise the dependencie username: neo4j password: neo4j ``` - You can leave the other fields blank. neo4j will then prompt you to change your password. Change it to whatever you please. + You can leave the other fields blank. neo4j will then prompt you to change your password. Change it to whatever you please and the new password will persist the next time you run neo4j locally. +1. When you have finished playing with your local neo4j instance, remember to stop it running by executing the below in your shell/terminal: + ```shell script + # find name of container running + docker ps + # stop container running + docker stop sqlquerygraph_neo4j_1 + ``` *** From 33bc8ae864f3a854a75d03165cad22891a33f78c Mon Sep 17 00:00:00 2001 From: avisionh Date: Mon, 24 May 2021 11:52:04 +0100 Subject: [PATCH 5/5] docs: Write CONTRIBUTING This is so we can set standards for contributing to the repo. --- .github/CONTRIBUTING.md | 106 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index e69de29..f10b775 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,106 @@ +# Contributing to sqlquerygraph +We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's: + +- Reporting a bug +- Discussing the current state of the code +- Submitting a fix +- Proposing new features +- Becoming a maintainer + +## We develop with Github +We use github to host code, to track issues and feature requests, as well as accept pull requests. + +## We use [Github Flow](https://guides.github.com/introduction/flow/index.html), so all code changes happen through Pull Requests +Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests: + +1. Fork the repo and create your branch from `master`. +2. If you've added code that should be tested, add tests. +3. If you've changed APIs, update the documentation. +4. Ensure the test suite passes. +5. Make sure your code lints. +6. Issue that pull request! + +## Any contributions you make will be under the MIT Software License +In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern. + +## Report bugs using Github's [Issues](https://github.com/avisionh/sqlquerygraph/issues) +We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/avisionh/sqlquerygraph/issues); it's that easy! + +## Write bug reports with detail, background, and sample code +[This is an example](http://stackoverflow.com/q/12488905/180626) of a bug report written, and it's not a bad model. Here's [another example from Craig Hockenberry](http://www.openradar.me/11905408). + +**Great Bug Reports** tend to have: + +- A quick summary and/or background +- Steps to reproduce + - Be specific! + - Give sample code if you can. [A stackoverflow question](http://stackoverflow.com/q/12488905/180626) includes sample code that *anyone* with a base R setup can run to reproduce what I was seeing +- What you expected would happen +- What actually happens +- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work) + +People *love* thorough bug reports. I'm not even kidding. + +*** + +## Use a consistent Python coding style +We use [black](https://black.readthedocs.io/en/stable/). The [pre-commit hooks](./.pre-commit-config.yml) also formats any Python code automatically. +* Tabs or four spaces for indentation +* Name your objects explicity, be descriptive + +*** + +## Use a consistent Git messaging structure +More detail is available on the repo's wiki, [House Styles: Git](https://github.com/avisionh/sqlquerygraph/wiki/House-Styles:-Git), but in short. + +### Branch ++ **Principle**: Each branch should have a single purpose. ++ **Frequency:** Every time you want to work on part of a project, create a branch for it. ++ **Naming Convention**: + - `type/name` - this lets branches of the same type be grouped together in VSTS + - Choose short and descriptive names + +``` +Note this is not an exhaustive list: + +feature Additional functionality or features +devops Software development/IT operation-related changes +bugfix Fixing an error +data Updating data or data connections +format Changing the format/layout +document Create documents for community standards + +Any suggestions, let us know! +``` + +### Commit ++ **Principle**: Include "what the commit does" as well as "why it does it" if the "what the commit does" message is not sufficient. Like Twitter, any commit message cannot be longer than 80 characters. ++ **Frequency:** Commit often and early, to ensure you don't lose any work. Don't worry about your `git log` or `git nl` looking ugly. You can clean this up afterwards. ++ **Naming Convention**: Should follow the below form, where * and * are mandatory, whilst * and `* are optional. + - If * and * are present, * is mandatory. + +``` +: + + + +