In the steps below, ~/.env3 is used a virtualenv directory, and ~/github.com is used as a location of dbt-singlestore folder containing these sources. Certain parts of code have been copied from
https://github.com/dbeatty10/dbt-mysql and subsequently modified.
Replace dbt-core and dbt-tests-adapter values in the dev_requirements.txt file with the version you want to work with
pip install virtualenv &&
virtualenv ~/.env3 -p /usr/bin/python3 &&
source ~/.env3/bin/activate
- Install test packages
pip install -r dev_requirements.txt - Run SingleStore server instance locally or use Managed Service instance.
- Create a file named
test.envand fill credentials in ENV variables referenced intests/conftest.py. - A database named
dbt_testis used in tests. Snapshot tests expect it to be empty before running the tests. Therefore, prior to running the test suite, the following SQL must be executed:DROP DATABASE IF EXISTS dbt_test; CREATE DATABASE dbt_test; - Run the tests:
pytest- append
--pdbto debug - append
-k <test_name>to run a specific test Example:pytest -k TestSingularTestsMyAdapter --pdb
- append
In order to get the file structure for this repository, the following commands have been used
virtualenv ~/.env3 -p /usr/bin/python3;
source ~/.env3/bin/activate;
pip install dbt-core dbt-postgres;
pip install singlestoredb=1.2.0;
cd <PATH_TO_DBT_CORE>/core/scripts;
python create_adapter_plugins.py --sql --title-case=SingleStore ~/github.com/ singlestore;
mv ~/github.com/singlestore ~/github.com/dbt-singlestore;
git init;
mkdir -p build # folder for artifacts and test scripts
pip3 install setuptools --upgrade
pip3 install --upgrade build twine
python3 setup.py sdist; python3 setup.py bdist_wheel --universal; twine upload dist/*