Advertisement

Python百日进阶-Web开发-PeeweeDay280 - SQLite 扩展(五)

阅读量:

文章目录

      • 12.2.11 class TableFunction
      • 12.2.12 ClosureTable
      • 12.2.13 class BaseClosureTable

12.2.11 class TableFunction

复制代码
    class TableFunction

开发自定义表格值函数。与仅返回单一标量数据的常规标量或聚合函数不同,自定义表格值函数能够生成任意数量的数据行。

简单的例子:

复制代码
    from playhouse.sqlite_ext import TableFunction
    
    
    class Series(TableFunction):
    # Name of columns in each row of generated data.
    columns = ['value']
    
    # Name of parameters the function may be called with.
    params = ['start', 'stop', 'step']
    
    def initialize(self, start=0, stop=None, step=1):
        """

全部评论 (0)

还没有任何评论哟~