# Part of accounting-api project:
# https://gitorious.org/conservancy/accounting-api
# License: AGPLv3-or-later
import logging
import json
from flask.ext.sqlalchemy import SQLAlchemy
from accounting.exceptions import AccountingException
from accounting.storage import Storage
from accounting.models import Transaction, Posting, Amount
_log = logging.getLogger(__name__)
db = SQLAlchemy()
class SQLStorage(Storage):
def __init__(self, app=None):
if not app:
raise Exception('Missing app keyword argument')
self.app = app
db.init_app(app)
from .models import Transaction as SQLTransaction, \
Posting as SQLPosting, Amount as SQLAmount