跳转到主要内容

Guillotina的Postgres字段支持

项目描述

简介

使用外部PG数据库的pgfield的简单方法

基本说明

  • Python >= 3.7
  • PostgreSQL >= 9.6
  load_utilities:
    pgfield:
      factory: guillotina_pgfield.utility.PGFieldUtility
      provides: guillotina_pgfield.interfaces.IPGFieldUtility
      settings:
        dsn: postgres://user:passwd@pg_url:5432/db
        pool_size: 10

内容类型定义

FOOBAR_PG = [
    Column("num", Float),
    Column("text", String, nullable=True)]

FOOBAR_SCHEMA = {
    "$schema": "https://json-schema.fullstack.org.cn/draft-07/schema#",
    "type": "object",
    "properties": {
        "num": {"type": "number"},
        "text": {"type": "string"}
    }
}
async def foobar_validator(context, value):
    return True


class IFoobarType(Interface):
    foobar = PatchField(
        PGListField(
            title="foobar",
            json_schema=FOOBAR_SCHEMA,
            validator=foobar_validator,
            pg_schema=FOOBAR_PG,
            pg_table="foobar",
            required=False,
        )
    )

项目详情


下载文件

下载适用于您的平台文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分布

guillotina_pgfield-2.0.1.tar.gz (7.6 kB 查看哈希值)

上传时间:

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面