Skip to main content

Postgres field support for Guillotina

Project description

Introduction

Naive aproach of pgfield with an external PG database

Basic instructions

  • 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

Content type definition

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

FOOBAR_SCHEMA = {
    "$schema": "http://json-schema.org/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,
        )
    )

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

guillotina_pgfield-2.0.1.tar.gz (7.6 kB view details)

Uploaded Source

File details

Details for the file guillotina_pgfield-2.0.1.tar.gz.

File metadata

  • Download URL: guillotina_pgfield-2.0.1.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for guillotina_pgfield-2.0.1.tar.gz
Algorithm Hash digest
SHA256 7849ae14afef634067114e4291955ef01e3b9c764bf0f9a550a9382c4e2e5b66
MD5 7ab92b9fca072a6a68ad1b22fccb2011
BLAKE2b-256 d020092c56e90f9e4f053beb5e0eba7faef6c77ff202636e159a226e5bd758a1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page