pgsync-fork


Namepgsync-fork JSON
Version 2.7.3 PyPI version JSON
download
home_pagehttps://github.com/toluaina/pgsync
SummaryPostgres to Elasticsearch/OpenSearch sync
upload_time2023-08-13 17:13:15
maintainerTolu Aina
docs_urlNone
authorTolu Aina
requires_python>=3.7.0
licenseLGPLv3
keywords pgsync elasticsearch opensearch postgres change data capture
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # PostgreSQL to Elasticsearch/OpenSearch sync


- [PGSync](https://pgsync.com) is a middleware for syncing data from [Postgres](https://www.postgresql.org) to [Elasticsearch](https://www.elastic.co/products/elastic-stack)/[OpenSearch](https://opensearch.org/) or [OpenSearch](https://opensearch.org/).
- It allows you to keep [Postgres](https://www.postgresql.org) as your source of truth data source and
expose structured denormalized documents in [Elasticsearch](https://www.elastic.co/products/elastic-stack)/[OpenSearch](https://opensearch.org/).


### Requirements

- [Python](https://www.python.org) 3.7+
- [Postgres](https://www.postgresql.org) 9.6+
- [Redis](https://redis.io) 3.1.0
- [Elasticsearch](https://www.elastic.co/products/elastic-stack) 6.3.1+ or [OpenSearch](https://opensearch.org/) 1.3.7+
- [SQlAlchemy](https://www.sqlalchemy.org) 1.3.4+

### Postgres setup
  
  Enable [logical decoding](https://www.postgresql.org/docs/current/logicaldecoding.html) in your 
  Postgres setting.

  - You also need to set up two parameters in your Postgres config postgresql.conf

    ```wal_level = logical```

    ```max_replication_slots = 1```

### Installation

You can install PGSync from [PyPI](https://pypi.org):

    $ pip install pgsync

### Config

Create a schema for the application named e.g **schema.json**

[Example schema](https://github.com/toluaina/pgsync/blob/main/examples/airbnb/schema.json)

Example spec

.. code-block::

    [
        {
            "database": "[database name]",
            "index": "[Elasticsearch or OpenSearch index]",
            "nodes": {
                "table": "[table A]",
                "schema": "[table A schema]",
                "columns": [
                    "column 1 from table A",
                    "column 2 from table A",
                    ... additional columns
                ],
                "children": [
                    {
                        "table": "[table B with relationship to table A]",
                        "schema": "[table B schema]",
                        "columns": [
                          "column 1 from table B",
                          "column 2 from table B",
                          ... additional columns
                        ],
                        "relationship": {
                            "variant": "object",
                            "type": "one_to_many"
                        },
                        ...
                    },
                    {
                        ... additional children
                    }
                ]
            }
        }
    ]

### Environment variables 

Setup environment variables required for the application

    SCHEMA='/path/to/schema.json'

    ELASTICSEARCH_HOST=localhost
    ELASTICSEARCH_PORT=9200

    PG_HOST=localhost
    PG_USER=i-am-root # this must be a postgres superuser or replication user
    PG_PORT=5432
    PG_PASSWORD=*****

    REDIS_HOST=redis
    REDIS_PORT=6379
    REDIS_DB=0
    REDIS_AUTH=*****


### Running

Bootstrap the database (one time only)
  - $ bootstrap --config schema.json

Run pgsync as a daemon
  - $ pgsync --config schema.json --daemon

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/toluaina/pgsync",
    "name": "pgsync-fork",
    "maintainer": "Tolu Aina",
    "docs_url": null,
    "requires_python": ">=3.7.0",
    "maintainer_email": "tolu@pgsync.com",
    "keywords": "pgsync,elasticsearch,opensearch,postgres,change data capture",
    "author": "Tolu Aina",
    "author_email": "tolu@pgsync.com",
    "download_url": "https://files.pythonhosted.org/packages/48/10/cfd341da8b2e94fb87e3c4a3038e00179c681e772cc53adfa134201288f8/pgsync-fork-2.7.3.tar.gz",
    "platform": null,
    "description": "# PostgreSQL to Elasticsearch/OpenSearch sync\n\n\n- [PGSync](https://pgsync.com) is a middleware for syncing data from [Postgres](https://www.postgresql.org) to [Elasticsearch](https://www.elastic.co/products/elastic-stack)/[OpenSearch](https://opensearch.org/) or [OpenSearch](https://opensearch.org/).\n- It allows you to keep [Postgres](https://www.postgresql.org) as your source of truth data source and\nexpose structured denormalized documents in [Elasticsearch](https://www.elastic.co/products/elastic-stack)/[OpenSearch](https://opensearch.org/).\n\n\n### Requirements\n\n- [Python](https://www.python.org) 3.7+\n- [Postgres](https://www.postgresql.org) 9.6+\n- [Redis](https://redis.io) 3.1.0\n- [Elasticsearch](https://www.elastic.co/products/elastic-stack) 6.3.1+ or [OpenSearch](https://opensearch.org/) 1.3.7+\n- [SQlAlchemy](https://www.sqlalchemy.org) 1.3.4+\n\n### Postgres setup\n  \n  Enable [logical decoding](https://www.postgresql.org/docs/current/logicaldecoding.html) in your \n  Postgres setting.\n\n  - You also need to set up two parameters in your Postgres config postgresql.conf\n\n    ```wal_level = logical```\n\n    ```max_replication_slots = 1```\n\n### Installation\n\nYou can install PGSync from [PyPI](https://pypi.org):\n\n    $ pip install pgsync\n\n### Config\n\nCreate a schema for the application named e.g **schema.json**\n\n[Example schema](https://github.com/toluaina/pgsync/blob/main/examples/airbnb/schema.json)\n\nExample spec\n\n.. code-block::\n\n    [\n        {\n            \"database\": \"[database name]\",\n            \"index\": \"[Elasticsearch or OpenSearch index]\",\n            \"nodes\": {\n                \"table\": \"[table A]\",\n                \"schema\": \"[table A schema]\",\n                \"columns\": [\n                    \"column 1 from table A\",\n                    \"column 2 from table A\",\n                    ... additional columns\n                ],\n                \"children\": [\n                    {\n                        \"table\": \"[table B with relationship to table A]\",\n                        \"schema\": \"[table B schema]\",\n                        \"columns\": [\n                          \"column 1 from table B\",\n                          \"column 2 from table B\",\n                          ... additional columns\n                        ],\n                        \"relationship\": {\n                            \"variant\": \"object\",\n                            \"type\": \"one_to_many\"\n                        },\n                        ...\n                    },\n                    {\n                        ... additional children\n                    }\n                ]\n            }\n        }\n    ]\n\n### Environment variables \n\nSetup environment variables required for the application\n\n    SCHEMA='/path/to/schema.json'\n\n    ELASTICSEARCH_HOST=localhost\n    ELASTICSEARCH_PORT=9200\n\n    PG_HOST=localhost\n    PG_USER=i-am-root # this must be a postgres superuser or replication user\n    PG_PORT=5432\n    PG_PASSWORD=*****\n\n    REDIS_HOST=redis\n    REDIS_PORT=6379\n    REDIS_DB=0\n    REDIS_AUTH=*****\n\n\n### Running\n\nBootstrap the database (one time only)\n  - $ bootstrap --config schema.json\n\nRun pgsync as a daemon\n  - $ pgsync --config schema.json --daemon\n",
    "bugtrack_url": null,
    "license": "LGPLv3",
    "summary": "Postgres to Elasticsearch/OpenSearch sync",
    "version": "2.7.3",
    "project_urls": {
        "Bug Reports": "https://github.com/toluaina/pgsync/issues",
        "Documentation": "https://pgsync.com",
        "Funding": "https://github.com/sponsors/toluaina",
        "Homepage": "https://github.com/toluaina/pgsync",
        "Source": "https://github.com/toluaina/pgsync",
        "Web": "https://pgsync.com"
    },
    "split_keywords": [
        "pgsync",
        "elasticsearch",
        "opensearch",
        "postgres",
        "change data capture"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d7b1bb22fdc06127a569c61aa91b9c2e0e677cf44e553b4041e7f946e88b30c4",
                "md5": "302841942a6e6458bb689fb37a7562e5",
                "sha256": "8c4bf49d6dd5c827143e5c0749086881fd62a96a269f7c3d116419ef709e28ea"
            },
            "downloads": -1,
            "filename": "pgsync_fork-2.7.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "302841942a6e6458bb689fb37a7562e5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7.0",
            "size": 57903,
            "upload_time": "2023-08-13T17:13:13",
            "upload_time_iso_8601": "2023-08-13T17:13:13.200429Z",
            "url": "https://files.pythonhosted.org/packages/d7/b1/bb22fdc06127a569c61aa91b9c2e0e677cf44e553b4041e7f946e88b30c4/pgsync_fork-2.7.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4810cfd341da8b2e94fb87e3c4a3038e00179c681e772cc53adfa134201288f8",
                "md5": "534649888f3d8d6071b55574b306108f",
                "sha256": "29d210f5b365829c8336412920591161cccaeaf2fd4aa6c077ab32a03e768d1d"
            },
            "downloads": -1,
            "filename": "pgsync-fork-2.7.3.tar.gz",
            "has_sig": false,
            "md5_digest": "534649888f3d8d6071b55574b306108f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7.0",
            "size": 110177,
            "upload_time": "2023-08-13T17:13:15",
            "upload_time_iso_8601": "2023-08-13T17:13:15.344847Z",
            "url": "https://files.pythonhosted.org/packages/48/10/cfd341da8b2e94fb87e3c4a3038e00179c681e772cc53adfa134201288f8/pgsync-fork-2.7.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-13 17:13:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "toluaina",
    "github_project": "pgsync",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "pgsync-fork"
}
        
Elapsed time: 0.10174s