當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。