Django Models / SQLAlchemy are bloated! Any truly Pythonic DB models out there?
Posted
by Luke Stanley
on Stack Overflow
See other posts from Stack Overflow
or by Luke Stanley
Published on 2010-06-04T22:13:11Z
Indexed on
2010/06/05
10:42 UTC
Read the original article
Hit count: 441
"Make things as simple as possible, but no simpler."
Can we find the solution/s that fix the Python database world?
from someAmazingDB import *
class Task (model):
title = ''
isDone = False
db.taskList = []
#or
db.taskList = expandableTypeCollection(Task) #not sure what this syntax would be
db['taskList'].append(Task(title='Beat old sql interfaces',done=False))
db.taskList.append(Task('Illustrate different syntax modes',True))
#at this point it should autosave
#we should be able to reload the console and access like:
>> from someAmazingDB import *
>> print 'Done tasks:'
>> for task in db.taskList:
>> if task.done:
>> print task
'Illustrate different syntax modes'
I'm a fan of Python, webPy and Cherry Py, and KISS in general.
We're talking automatic Python to SQL type translation or NoSQL. We don't have to totally be SQL compatible! Just a scalable subset or ignore it!
Re:model changes, it's ok to ask the developer when they try to change it or have a set of sensible defaults.
Here is the challenge: The above code should work with very little modification or thinking required. Why must we put up with compromise when we know better?
It's 2010, we should be able to code scalable, simple databases in our sleep.
If you think this is important, please upvote!
© Stack Overflow or respective owner