-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Additional sqlalchemy utilities #8
Comments
I think the scope of this project is exactly what you described it: a grab-bag of utils for sqlalchemy. As for larger extensions we could create entirely new repositories. I've already done this with: https://github.com/kvesteri/wtforms-alchemy As for the features you suggested, here is my two cents:
|
I added you as a contributor for this project. |
Good stuff; I appreciate it. I'm going to start by opening issues for a few of these. |
Thanks for creating the issues, great stuff! Out of curiosity which MVC framework are you using? |
As our development focuses primarily on RESTful interfaces, we use https://github.com/armet/python-armet as the view / controller layer. Armet is a framework-agnostic REST framework. Currently it connects to django, bottle, cyclone, and flask for the http layer and django or sqlalchemy for the model layer (and any combination of the two layers is supported). We're using it tied to flask for the http layer at the moment with (semi-obviously) sqlalchemy for the model layer. |
@kvesteri Let me know what you think of alchemist: https://github.com/concordusapps/alchemist It's meant to be the glue between flask and sqlalchemy using many of the same conventions django provides (such as segmented applications). It also provides (using flask-script) a powerful CLI to manage the db, server, etc. |
I like many of the concepts you have there. Maybe this package would be better split in two separate concerns? How about Flask-Packages and Flask-AlchemyScript (or Flask-Script-SQLAlchemy :) ?. |
@mehcode What kind of data validation are you using for REST APIs? We've used WTForms along with WTForms-JSON and WTForms-Alchemy for data validation with POST, PUT and PATCH requests. It would be great if we could collaborate on these projects too. |
https://github.com/armet/python-armet has its own internal validation: from armet import resources
from . import models
class Resource(resources.ModelResource):
class Meta:
connectors = {'http': 'flask', 'model': 'sqlalchemy'}
model = models.User
def clean_name(self, value):
assert len(value) > 10, 'Name must be longer than 10 characters'
return value With the above definition and the following request...
The response would be ...
The idea is any ValueErrors or AssertionErrors that get triggered anywhere get collected according to the context of the call and formed into this error dictionary. For instance, this allows any Futerhmore, I've been planning to allow linking up a django form to handle validation (in django of course). class Resource(resources.ModelResource):
class Meta:
connectors = {'http': 'flask', 'model': 'django'}
form = UserForm It'd be nice to have other form libraries to plugin into armet (like WTForms). I'll definitely put it on the TODO list to create the binding between Along the same line of thinking, I'd love to get some collaboration going for armet if you're interested. Most of my free time next week I have set aside for documentation, website, and various things for it. |
I have a number of nifty things I've developed (or found and spruced up) for sqlalchemy that don't have a real place at the moment and I'd like to find them one in open source land. What is the scope of this project? A grab-bag of all utils for sqlalchemy?
Some things for consideration:
That's all I can think of.. I can probably dig up some more. The point is that I use a lot of these in a lot of our projects and It'd be nice to put them somewhere on github. If you don't think just adding some more buckets to this project would be a good idea; do you have another? We could always add lots of "extra_requires" (for any additional dependencies).
The text was updated successfully, but these errors were encountered: