Skip to content

Commit

Permalink
Add sqlalchemy verbose setting (#5)
Browse files Browse the repository at this point in the history
* add ability to reduce sqlalchemy logging via environment vars
  • Loading branch information
anmaxvl authored Apr 10, 2019
1 parent 5eab073 commit e6b6818
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions indexd/default_settings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

from .alias.drivers.alchemy import SQLAlchemyAliasDriver
from .auth.drivers.alchemy import SQLAlchemyAuthDriver
from .index.drivers.alchemy import SQLAlchemyIndexDriver
Expand All @@ -6,11 +8,14 @@

CONFIG['JSONIFY_PRETTYPRINT_REGULAR'] = False
AUTO_MIGRATE = True
SQLALCHEMY_VERBOSE = (
os.getenv('INDEXD_VERBOSE', '').lower() in ['1', 'yes', 'true']
)
PG_URL = 'postgres://test:test@localhost/indexd_test'

CONFIG['INDEX'] = {
'driver': SQLAlchemyIndexDriver(
PG_URL, auto_migrate=AUTO_MIGRATE, echo=True,
PG_URL, auto_migrate=AUTO_MIGRATE, echo=SQLALCHEMY_VERBOSE,
index_config={
'DEFAULT_PREFIX': 'testprefix:',
'ADD_PREFIX_ALIAS': True,
Expand All @@ -21,7 +26,7 @@

CONFIG['ALIAS'] = {
'driver': SQLAlchemyAliasDriver(
PG_URL, auto_migrate=AUTO_MIGRATE, echo=True),
PG_URL, auto_migrate=AUTO_MIGRATE, echo=SQLALCHEMY_VERBOSE),
}

CONFIG['DIST'] = [
Expand Down

0 comments on commit e6b6818

Please sign in to comment.