-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
connection class as parameter in database class #14
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! I guess it does what we talked about. See my one comment below.
Tests pass on Travis and locally on my machine. However we get the following warnings:
I guess the warning about default values can be ignored, is there a way to accept, suppress these warnings? Then there is something about imp vs. importlib, which I can't make sense of. It seems these are not even part of the package? |
The distutils warning could stem from an outdated virtualenv version. I will look into this in Travis. It has nothing to do with the package code.
One can use pytest.ini to filter/suppress warnings. I guess I could also just add random default values for the test tables mentioned...
Holen Sie sich Outlook für Android<https://aka.ms/ghei36>
…________________________________
From: Sebastian Warnholz <notifications@github.com>
Sent: Wednesday, March 4, 2020 3:46:44 PM
To: INWTlab/dbrequests <dbrequests@noreply.github.com>
Cc: Matthaeus Deutsch <mdeutsch@outlook.com>; Assign <assign@noreply.github.com>
Subject: Re: [INWTlab/dbrequests] connection class as parameter in database class (#14)
Tests pass on Travis and locally on my machine. However we get the following warnings:
=============================== warnings summary ===============================
.venv/lib/python3.6/distutils/__init__.py:4
/home/travis/build/INWTlab/dbrequests/.venv/lib/python3.6/distutils/__init__.py:4: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
dbrequests/tests/test_connection.py::TestConnection::test_send_data_update
dbrequests/tests/test_database.py::TestDatabase::test_send_data_update
/home/travis/build/INWTlab/dbrequests/.venv/lib/python3.6/site-packages/pymysql/cursors.py:170: Warning: (1364, "Field 'name' doesn't have a default value")
result = self._query(query)
dbrequests/tests/test_connection.py::TestConnection::test_send_data_update
dbrequests/tests/test_database.py::TestDatabase::test_send_data_update
/home/travis/build/INWTlab/dbrequests/.venv/lib/python3.6/site-packages/pymysql/cursors.py:170: Warning: (1364, "Field 'owner' doesn't have a default value")
result = self._query(query)
-- Docs: https://docs.pytest.org/en/latest/warnings.html
================== 25 passed, 5 warnings in 212.62s (0:03:32) ==================
I guess the warning about default values can be ignored, is there a way to accept, suppress these warnings? Then there is something about imp vs. importlib, which I can't make sense of. It seems these are not even part of the package?
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub<#14?email_source=notifications&email_token=AEO76SUJOJ2NGHH2ECX7D73RFZSVJA5CNFSM4LATPSE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENYGKCI#issuecomment-594568457>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AEO76SSCIZQFIDYUXRF3CH3RFZSVJANCNFSM4LATPSEQ>.
|
The new version has been deployed to pypi.org. Please @wahani if you still use your own pypi server internally do the same (I dont recall if I had CD implemented, please check). I implemented setup.py publish for this. btw, we should build something similar for deploying to pypi and thinking about CD to pypi. |
This pull request is to refactor the Database class to initialize with a custom Connection class instead of calling it statically. This is the result of the discussion in #11, but does not cope with the issue there, but rather sets the ground work for having more extensibility with custom Connection classes.
I also showed how to extend the current setup in examples/connection_subclass.py. The idea is to mostly leave the Database class as is, but be able to extend / change the backend to accomodate custom needs.
Please review if this change goes along what you had in mind, @wahani! Also please pull and test, since I also refactored the Pipfile heavily. No tests were added, since no new features were added.