flask_restful_dbbase package

Subpackages

Submodules

flask_restful_dbbase.generator module

This module implements a technique for creating resources with specific methods.

A customized resource can be created from a resource, but with some of the default HTTP methods removed, but with customized resource modifications applied to make a unique resource.

flask_restful_dbbase.generator.create_resource(name, resource_class, model_class=None, methods=None, url_prefix=None, url_name=None, class_vars=None)[source]

This function creates a resource based on a source model class and a seed resource.

Parameters:
  • name – (str) : This will be the name stored with the new class.

  • resource_class – (obj) : This is the ModelResource class that will be used as the basis of the new class.

  • methods – (list) : This the list of HTTP methods that should be transferred to the new class.

  • url_prefix – (str) : This is url_prefix that can be used in place of the default url_prefix that comes with the resource class.

  • url_name – (str) : This the url_name that can be used in place of the default url_name that comes with the resource.

  • class_vars – (dict) : This is a dictionary of variables and values that will be transferred to the new resource. These are set in place last, so it is here that additional customization of the new resource can be made.

Returns:

(obj) – The new resource class

Module contents

class flask_restful_dbbase.DBBase(app=None, use_native_unicode=True, session_options=None, metadata=None, query_class=<class 'flask_sqlalchemy.BaseQuery'>, model_class=<class 'sqlalchemy.ext.declarative.api.Model'>, engine_options=None)[source]

Bases: SQLAlchemy