Skip to content

Commit

Permalink
Simplify code by assumming both SQLA and Peewee
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed May 14, 2020
1 parent 8b929d9 commit 1fd5848
Show file tree
Hide file tree
Showing 6 changed files with 288 additions and 299 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ This document records the main changes to the ``sdssdb`` code.
* Add `.PeeweeDatabaseConnection.get_model` to retrieve the model for a given table.
* :bug:`28` Temporarily remove SQLAlchemy implementation of ``sds5db`` since it's not maintained. We may reintroduce it later once the schema is stable.
* Use ``host=localhost`` when a profile is being used on its own domain.
* :support:`32` Assume that both SQLAlchemy and Peewee will be installed and simplify code.

* :release:`0.3.2 <2020-03-10>`
* Change ``operations-test`` profile to ``operations`` using the new machine hostname.
Expand Down
22 changes: 2 additions & 20 deletions python/sdssdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,5 @@
config = get_config(NAME, user_path='~/.sdssdb/sdssdb.yml')


try:
import peewee # noqa
_peewee = True
except ImportError:
_peewee = False

try:
import sqlalchemy # noqa
_sqla = True
except ImportError:
_sqla = False
if _peewee is False:
raise ImportError('neither SQLAlchemy nor Peewee are installed. '
'Install at least one of them to use sdssdb.')


if _peewee:
from .connection import PeeweeDatabaseConnection # noqa
if _sqla:
from .connection import SQLADatabaseConnection # noqa
from .connection import PeeweeDatabaseConnection # noqa
from .connection import SQLADatabaseConnection # noqa

0 comments on commit 1fd5848

Please sign in to comment.