From ac85a81bd1d96387864b9eddd4ff4ffb5897e56b Mon Sep 17 00:00:00 2001 From: Cassowary Rusnov Date: Wed, 2 Feb 2022 21:13:07 -0800 Subject: [PATCH] Add README for steps to load data into test instance. fix error in code. add requirements.txt --- README.md | 22 +++++++++------------- confdump.py | 1 + example.env | 2 ++ requirements.txt | 3 +++ 4 files changed, 15 insertions(+), 13 deletions(-) create mode 100644 example.env create mode 100644 requirements.txt diff --git a/README.md b/README.md index ff74767..f368f07 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,9 @@ -# Command line to dump - -FinancialType -PaymentProcessor -ContributionPage -Contact -Relationship -Group and Field tables -OptionValue and OptionGroup - -Resources urls and directories (sysetm settings) - -# Command line to load above dump +- Needs working local CiviCRM from caat-crm-installer +- In confdump path, `virtualenv confdump.venv` +- Load the virtualenv `. confdump.venv/bin/activate` +- Install pre-dependencies for MySQL client https://pypi.org/project/mysqlclient/ on dpkg based linuce: `python3-dev default-libmysqlclient-dev build-essential` +- Install requirements `pip -i requirements.txt` +- Fill out example.env for the production, test or development server you'll retrieve the data from. +- Execute dump to retrieve base data: `env $(cat example.env) python ./confdump.py dump -o mydata INSTANCEPATH` where INSTANCEPATH is something like https://crm.dev.caat.org.uk/. +- Load data into running local instance with: `python confdump.py mysql -i mydata/ -p 63306` +- Clear the cache in CiviCRM from the caat-crm-installer directory with `make shell`, and then inside `cd /app; ./vendor/bin/drush cc all` diff --git a/confdump.py b/confdump.py index eae06ca..6149d5c 100644 --- a/confdump.py +++ b/confdump.py @@ -227,6 +227,7 @@ def main() -> int: row['payment_processor'] = STANDIN_PAYMENT_PROCESSOR_ID for row in indata: query = dict_to_insert(table_name, row) + cursor.execute(query) cursor.execute("SET FOREIGN_KEY_CHECKS=1;") cursor.close() diff --git a/example.env b/example.env new file mode 100644 index 0000000..e513c36 --- /dev/null +++ b/example.env @@ -0,0 +1,2 @@ +CIVICRM_USERNAME=yourusername +CIVICRM_PASSWORD=yourpassword diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..77d97fc --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +-e git+https://git.autonomic.zone/cas/civicrmapi4#egg=civicrmapi4 +phpserialize +mysqlclient~=1.4.6