I'm developing an application using SQLAlchemy and wxPython that I'm trying to keep distributed in separated modules consisting of Business logic, ORM and GUI.
I'm not completely sure how to do this in a pythonic way.
Given that mapping()
has to be called in orther for the objects to be used, I thought of putting it on the __init__.py
of the bussiness logic, but keeping all the table definitions within a separate orm.py
module.
Should I keep something like:
/Business
/__init__.py
| mapping (module1.Class1, orm.table1)
|
/module1.py
Class1
/orm.py
import
table1 = Table()
/GUI
/main.py
| import business
/crud.py
or something like
/Business
/__init__.py
| import
|
/module1.py
Class1
table1 = Table()
mapping (module1.Class1, orm.table1)
/GUI
/main.py
| import business
/crud.py
Is the first approach recommended? Is there any other option? I've seen the second way, but I don't like putting the database handling code and the bussiness logic code within the same module. Am I overthinking it? Is really not that big a problem?