DBBase

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

Methods

apply_driver_hacks(app, sa_url, options)

This method is called before engine creation and used to inject driver specific hacks into the options.

apply_pool_defaults(app, options)

Changed in version 2.5.

create_all([bind, app])

Creates all tables.

create_engine(sa_url, engine_opts)

Override this method to have final say over how the SQLAlchemy engine is created.

create_scoped_session([options])

Create a scoped_session on the factory from create_session().

create_session(options)

Create the session factory used by create_scoped_session().

drop_all([bind, app])

Drops all tables.

get_app([reference_app])

Helper method that implements the logic to look up an application.

get_binds([app])

Returns a dictionary with a table->engine mapping.

get_engine([app, bind])

Returns a specific engine.

get_tables_for_bind([bind])

Returns a list of all tables relevant for a bind.

init_app(app)

This callback can be used to initialize an application for the use with this database setup.

make_connector([app, bind])

Creates the connector for a given state and bind.

make_declarative_base(model[, metadata])

Creates the declarative base that all models will inherit from.

reflect([bind, app])

Reflects tables from the database.

Attributes

Query

Default query class used by Model.query and other queries.

engine

Gives access to the engine.

metadata

The metadata associated with db.Model.