mtreinish / ciml

a machine learning pipeline for analyzing CI results.
Apache License 2.0
5 stars 4 forks source link

How to connect to the subunit2sql DB #48

Closed jlousada315 closed 4 years ago

jlousada315 commented 4 years ago

logstash.openstack.org/subunit2sql is the URL of a mysql database, so you need to use >an SQL client if you want to connect directly to it. See more details on >https://docs.openstack.org/infra/system-config/logstash.html#subunit2sql .

The subunit2sql >project defines the DB schema and also exposes a python API to access the data in the >DB.

Originally posted by @afrittoli in >https://github.com/mtreinish/ciml/issues/43#issuecomment-590221826

to use an SQL client if you want to connect directly to it. How do I connect ? I don't have MySQL experience, so I'm having trouble knowing which are the steps.

Thank you

jlousada315 commented 4 years ago

What I did was run on Terminal: subunit2sql --database-connection tempest-full

I think the argument is not correct.

afrittoli commented 4 years ago

The subunit2sql CLI can be used to inject subunit files into the DB, which is not what you need to do, at least not against openstack's DB.

You can browse the DB directly using the CLI or any SQL graphical client. In either case learning some SQL basics will help :)

You don't need to access the MySQL DB directly to use CIML, but it may help you understanding what data is available to you.

Example on using the CLI:

mysql -u query -p -h logstash.openstack.org -D subunit2sql

The password is query, the account is read only.

mysql> show tables;
+-----------------------+
| Tables_in_subunit2sql |
+-----------------------+
| alembic_version       |
| attachments           |
| run_metadata          |
| runs                  |
| test_metadata         |
| test_run_metadata     |
| test_runs             |
| tests                 |
+-----------------------+
8 rows in set (0.13 sec)
jlousada315 commented 4 years ago

Thank you , I managed to do that.

But when I try to make a --database-connection I get the following:

ImportError: dlopen(/usr/local/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so, 2): Library not loaded: @rpath/libmysqlclient.18.dylib Referenced from: /usr/local/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so Reason: image not found

afrittoli commented 4 years ago

@johnnylousas that seems to be a problem with your mysql library. I would recommend using pymsql as per requirements.txt. I'm going to go ahead and close this one which is about the direct connection to mysql. Feel free to open a new issue if you hit other problems.