Skip to main content

Guillotina Postgresql integration

Project description

guillotina_asyncom

POC of integrating a new Content-type DBFolder

  • A DBFolder represents a table on postgres with a related sqlalchemy model

Benefits

  • Use guillotina permission system
  • Use guillotina framework.
  • Lookup views on a context (a sqlalchemy object)
  • Integrate with the guillotina gmi interface

Howto use

  1. Create your regular sqlalchemy model, like, import your Base, from guillotina_asyncom.db
from guillotina_asyncom.db import Base
import sqlalchemy as sa

@implementer(IModel)
class Model(Base):
    __tablename__ = "extras"

    pk = sa.Column(sa.Integer, primary_key=True)
    value = sa.Column(sa.JSONB)

Add an object whenever you want of your guillotina content tree:

POST /db/guillotina/
{
    "@type": "DBFolder",
    "id", : "dbmodel",
    "model": "Model"
}

From here, we can just use the guillotina API with our new endpoint.

POST /db/guillotina/dbmodel/ { "value": {"prop", "value"} }

GET /db/guillotina/dbmodel/@search GET /db/guillotina/dbmodel/{pk} DELETE /db/guillotina/dbmodel/{pk} PATCH /db/guillotina/dbmodel/{pk}

Thought it should work registering services for instances...

POST /db/guillotina/dbmodel/{pk}/@requeue

  • Cool feature: It integrates with guillotina_react :)

IDEAS and TODOS

  • It's not hard to build a generic model explorer from here. All registered models on sqlalchemy live on Base.metadata... just build a small traversal around

  • Generate the expected schema for every new type, perhaps on the /db/guillotina/dbmodel/@schema taking it from declarative sqlalchemy models

  • Integrate the permission system on rows... Just implement an acl jsonb column in your models. (Setting the ownership, or whatever you want..)

  • The event system is still not implemented, perhaps could be implemented but with some new events. (If we do with the actuals we will mess with the catalog)

  • Implement a rich @search model (on the end we can just translate, the actual implementations to sqlalchemy querys). Also implement pagger, and the rest. This will make this fit so well with guillotina_react.

...

You are seeing a truncated changelog.

You can read the changelog file <https://github.com/plone/guillotina/blob/master/CHANGELOG.rst>_ for a complete list.

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_asyncom-0a1.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

guillotina_asyncom-0a1-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file guillotina_asyncom-0a1.tar.gz.

File metadata

  • Download URL: guillotina_asyncom-0a1.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.0

File hashes

Hashes for guillotina_asyncom-0a1.tar.gz
Algorithm Hash digest
SHA256 446bf075e6fbf74fa93fbaa0ede2fed41104f0f80cfbb41e810fc2f152f3dfff
MD5 c0e422c3630da552da0e55cc3e584f3f
BLAKE2b-256 9ca0175196f9049ada62502b86b3529a75aa0387de4b46780a9c19f9728e08bd

See more details on using hashes here.

File details

Details for the file guillotina_asyncom-0a1-py3-none-any.whl.

File metadata

  • Download URL: guillotina_asyncom-0a1-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.0

File hashes

Hashes for guillotina_asyncom-0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 f600b9c08eadf7049958b6c65171adf2f6472fd7cb849a5923f5ea38e4be4c98
MD5 2c213229bc315f8e746f8f2073b57047
BLAKE2b-256 6378b877f51166bfd923b312cc6c29bf85b4f4903d3c11463845986587bbdd45

See more details on using hashes here.

Supported by

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