当前位置: 首页>>代码示例>>Python>>正文


Python sqlalchemy.SQLAlchemy方法代码示例

本文整理汇总了Python中flask.ext.sqlalchemy.SQLAlchemy方法的典型用法代码示例。如果您正苦于以下问题:Python sqlalchemy.SQLAlchemy方法的具体用法?Python sqlalchemy.SQLAlchemy怎么用?Python sqlalchemy.SQLAlchemy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flask.ext.sqlalchemy的用法示例。


在下文中一共展示了sqlalchemy.SQLAlchemy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: url_for

# 需要导入模块: from flask.ext import sqlalchemy [as 别名]
# 或者: from flask.ext.sqlalchemy import SQLAlchemy [as 别名]
def url_for(self, model, **kw):
        """Returns the URL for the specified model, similar to
        :func:`flask.url_for`.

        `model` is a SQLAlchemy model class. This must be a model on which
        :meth:`create_api_blueprint` has been invoked previously.

        This method only returns URLs for endpoints created by this
        :class:`APIManager`.

        The remaining keyword arguments are passed directly on to
        :func:`flask.url_for`.

        """
        collection_name = self.collection_name(model)
        api_name = APIManager.api_name(collection_name)
        blueprint_name = self.blueprint_name(model)
        joined = '.'.join([blueprint_name, api_name])
        return flask.url_for(joined, **kw) 
开发者ID:yfauser,项目名称:planespotter,代码行数:21,代码来源:manager.py

示例2: collection_name

# 需要导入模块: from flask.ext import sqlalchemy [as 别名]
# 或者: from flask.ext.sqlalchemy import SQLAlchemy [as 别名]
def collection_name(self, model):
        """Returns the name by which the user told us to call collections of
        instances of this model.

        `model` is a SQLAlchemy model class. This must be a model on which
        :meth:`create_api_blueprint` has been invoked previously.

        """
        return self.created_apis_for[model].collection_name 
开发者ID:yfauser,项目名称:planespotter,代码行数:11,代码来源:manager.py

示例3: blueprint_name

# 需要导入模块: from flask.ext import sqlalchemy [as 别名]
# 或者: from flask.ext.sqlalchemy import SQLAlchemy [as 别名]
def blueprint_name(self, model):
        """Returns the name of the blueprint in which an API was created for
        the specified model.

        `model` is a SQLAlchemy model class. This must be a model on which
        :meth:`create_api_blueprint` has been invoked previously.

        """
        return self.created_apis_for[model].blueprint_name 
开发者ID:yfauser,项目名称:planespotter,代码行数:11,代码来源:manager.py


注:本文中的flask.ext.sqlalchemy.SQLAlchemy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。