pycdc


Namepycdc JSON
Version 1.1 PyPI version JSON
download
home_pagehttps://github.com/1997vijay/PyCDC.git
SummaryThis package enables the generation of a DataFrame with Change Data Capture (CDC) flags ('I' for Insert, 'U' for Update, and 'D' for Delete) by comparing historical and source data files
upload_time2023-12-16 11:18:16
maintainer
docs_urlNone
authorVijay Kumar
requires_python
licenseMIT
keywords cdc change data capture
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            This package enables the generation of a DataFrame with Change Data Capture (CDC) flags ('I' for Insert, 'U' for Update, and 'D' for Delete) by comparing historical and source data files

## Installation

Use the package manager `pip` to install pycdc.

```bash
pip install pycdc
```

## Usage
This package enables the generation of a DataFrame with Change Data Capture (CDC) flags ('I' for Insert, 'U' for Update, and 'D' for Delete) by comparing historical and source data files.It achieves this by comparing the structures of historical and source data files to ensure they share the same column structure.
```python
import pandas as pd
from pycdc import CDCGenerator

def read_file(filePath):
    try:
        df=pd.read_csv(filePath)
        return df
    except FileNotFoundError as e:
        raise e

sourceDataFrame=read_file('data/sales_data.csv') # your current source file
previousDataFrame=read_file('history/sales_data.csv') # your history file

cdcDataframe=CDCGenerator(
    keyColumn=['ProductID','Date'],
    sourceDataframe=sourceDataFrame,
    previousDataframe=previousDataFrame).perform_cdc()
print(cdcDataframe)
```
```
Output:-

| Date       | ProductID | Quantity | CDC_Flag |
|------------|-----------|----------|----------|
| 2023-02-03 | 1013      | 20       | I        |
| 2023-02-03 | 1014      | 20       | I        |
| 2023-01-02 | 1002      | 1500     | U        |
| 2023-02-03 | 1012      | 20       | D        |
```



## Contributing
our contributions to this project are encouraged and valued! You have the autonomy to make modifications directly and merge them without the need for a formal review process. You have the freedom to utilize the code in any manner you deem fit. 

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/1997vijay/PyCDC.git",
    "name": "pycdc",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "cdc,Change Data Capture",
    "author": "Vijay Kumar",
    "author_email": "vijay.kumar.1997@outlook.com",
    "download_url": "",
    "platform": null,
    "description": "This package enables the generation of a DataFrame with Change Data Capture (CDC) flags ('I' for Insert, 'U' for Update, and 'D' for Delete) by comparing historical and source data files\r\n\r\n## Installation\r\n\r\nUse the package manager `pip` to install pycdc.\r\n\r\n```bash\r\npip install pycdc\r\n```\r\n\r\n## Usage\r\nThis package enables the generation of a DataFrame with Change Data Capture (CDC) flags ('I' for Insert, 'U' for Update, and 'D' for Delete) by comparing historical and source data files.It achieves this by comparing the structures of historical and source data files to ensure they share the same column structure.\r\n```python\r\nimport pandas as pd\r\nfrom pycdc import CDCGenerator\r\n\r\ndef read_file(filePath):\r\n    try:\r\n        df=pd.read_csv(filePath)\r\n        return df\r\n    except FileNotFoundError as e:\r\n        raise e\r\n\r\nsourceDataFrame=read_file('data/sales_data.csv') # your current source file\r\npreviousDataFrame=read_file('history/sales_data.csv') # your history file\r\n\r\ncdcDataframe=CDCGenerator(\r\n    keyColumn=['ProductID','Date'],\r\n    sourceDataframe=sourceDataFrame,\r\n    previousDataframe=previousDataFrame).perform_cdc()\r\nprint(cdcDataframe)\r\n```\r\n```\r\nOutput:-\r\n\r\n| Date       | ProductID | Quantity | CDC_Flag |\r\n|------------|-----------|----------|----------|\r\n| 2023-02-03 | 1013      | 20       | I        |\r\n| 2023-02-03 | 1014      | 20       | I        |\r\n| 2023-01-02 | 1002      | 1500     | U        |\r\n| 2023-02-03 | 1012      | 20       | D        |\r\n```\r\n\r\n\r\n\r\n## Contributing\r\nour contributions to this project are encouraged and valued! You have the autonomy to make modifications directly and merge them without the need for a formal review process. You have the freedom to utilize the code in any manner you deem fit. \r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "This package enables the generation of a DataFrame with Change Data Capture (CDC) flags ('I' for Insert, 'U' for Update, and 'D' for Delete) by comparing historical and source data files",
    "version": "1.1",
    "project_urls": {
        "Homepage": "https://github.com/1997vijay/PyCDC.git"
    },
    "split_keywords": [
        "cdc",
        "change data capture"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "954f629cef9ce128343a09d75f45c14d46bdc6a90c5d99065030012bd8268124",
                "md5": "cef5d498101c7b87f941d03e45a5bdf1",
                "sha256": "c342bedf684275039b691776e934ad0b8e2b94456df048a8e75886d769e5af10"
            },
            "downloads": -1,
            "filename": "pycdc-1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cef5d498101c7b87f941d03e45a5bdf1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5728,
            "upload_time": "2023-12-16T11:18:16",
            "upload_time_iso_8601": "2023-12-16T11:18:16.230168Z",
            "url": "https://files.pythonhosted.org/packages/95/4f/629cef9ce128343a09d75f45c14d46bdc6a90c5d99065030012bd8268124/pycdc-1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-16 11:18:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "1997vijay",
    "github_project": "PyCDC",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pycdc"
}
        
Elapsed time: 2.52390s