Reusable CRUD
See original GitHub issueI would like to build a reusable CRUD view class on top of flask-rest-api. I built one previously fairly close to flask-restful’s design, and was wondering if anything currently exists or you have tips or suggestions of how to proceed.
The problem I am trying to solve is building the same list/get/update/delete endpoints over and over for various DB models. I want to declare things like access controls, default schema for serialization, what fields are permitted to update, DB model class, relationships to prefetch (i.e. joinedload
) for list view, and auto-registration of endpoints via __init_subclass__
.
Anything you’d suggest or like to see? Anything like this exist already on top of flask-rest-api?
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (6 by maintainers)
Top Results From Across the Web
Creating a Reusable CRUD RESTful Web Service ... - InformIT
Expert programmer Jesse Smith shows you how you can save time by creating a reusable CRUD RESTful web service.
Read more >Node:CRUD examples to demonstrate using a reusable ...
Node:CRUD examples to demonstrate using a reusable helper function to execute promises in sequence. While working on a Node application, ...
Read more >Crud Bud Reusable Glass Cleaner - 16.9oz - Walmart.com
Breaking down residue, gunk and crud with ease to make your glassware look new again. Each bottle contains 16.9oz of reusable cleaner liquid,...
Read more >Reusable Crud Service Llai - StackBlitz
import { Component } from '@angular/core';. import { UserService } ...
Read more >Generate CRUD procedures for a table - Documentation
SQL Complete generates customizable and reusable CRUD procedures for any particular table that can be executed in the following way:.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I get what you mean about needing to override details. I’ve worked with these libraries before in both perl and python, and it’s mostly a matter of creating a base class and defining the parameters you mention in class vars, and then having default implementations of the methods list, get, create, update, delete.
@lafrech Dunno whether to reopen this or start a new thread.
I ran into something similar a while back and did end up creating my own CRUD blueprint class. Would be happy to try and refactor it into something usable in flask-smorest, if you think this might be of interest.
My approach is similar to @revmischa above (with a few differences)…
I think an access-control framework, and a CRUD class, would be two really useful additions to smorest, and decrease cruft/code-repetition hugely. Maybe worth workshopping the needs/implementation details before working on a Pull Request…