| Name | csvddata-importer JSON |
| Version |
0.1.0
JSON |
| download |
| home_page | |
| Summary | Supports importing files to a database using a mapping configuration. |
| upload_time | 2023-10-28 13:10:47 |
| maintainer | |
| docs_url | None |
| author | |
| requires_python | >=3.11 |
| license | MIT License Copyright (c) 2023 Ernan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
pandas
pytest
psycopg2
SQLAlchemy
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
csvdata-importer
================
Documentation
-------------
https://data-importer.readthedocs.io
Installation
------------
$ pip install csvdata-importer
CSV Data Importer
-----------------
A configurable file to database table importer.
It can be used to import data from a csv file to a postgres
or sqlite database.
You build a mapping json file and then use that to create or update tables
on the database.
.. image:: docs/img/process.jpg
:width: 250px
:height: 120px
:scale: 100% %
:alt: the process used to import data
:align: center
Mapping file Example
--------------------
.. code-block:: json
{
"DATABASE_URL": "postgresql://user:pwd@host:5432/db",
"TARGET_TABLE": "quote",
"IF_EXISTS": "append",
"COLUMN_MAPPING": [
{
"COLUMN_NAME": "source",
"FILE_COLUMN_NAME": "source",
"MAPPING_TYPE": "CONSTANT",
"CONSTANT_VALUE": "test-data"
},
{
"COLUMN_NAME": "quote_value",
"FILE_COLUMN_NAME": "close",
}
]
}
Importing data using the mapping file
-------------------------------------
The overall mapping configuration
.. list-table:: Columns and their function inf the mapping file
:widths: 20 30 50
:header-rows: 1
* - Column Name
- Example
- Description
* - DATABASE_URL
- postgresql://user:pass@host:5432/db
- The database we are connecting to
* - TARGET_TABLE
- quote
- The table in that database we are updating or creating
* - FILE_PATH
- /test.csv
- The file we are importing
* - IF_EXISTS
- append
- The action taken on the table if it is non empty. Can be one of fail, append.
* - COLUMN_MAPPING
- array of columns see next table
- The columns and how they are mapped
The column mappings
.. list-table:: Columns mappings
:widths: 20 30 50
:header-rows: 1
* - Column Name
- Example
- Description
* - COLUMN_NAME
- quote_value
- The table column we are updating
* - FILE_COLUMN_NAME
- quote
- The column in the csv we are reading from
* - MAPPING_TYPE
- DIRECT
- The type of mapping we are doing. See below
* - CONSTANT_VALUE
- File Import
- For use when we are evaluating or mapping a constant to the table.
Different types of mappings
---------------------------
DIRECT
In this case we read the value form the file and write it directly to the table row column.
CONSTANT
In this case it is a constant value and we are just updating the table with the value we find in the CONSTANT_VALUE mapping.
EVALUATION
Here we are evaluating some code to create the data.
Raw data
{
"_id": null,
"home_page": "",
"name": "csvddata-importer",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": "",
"keywords": "",
"author": "",
"author_email": "Ernan <ernan@outlook.com>",
"download_url": "https://files.pythonhosted.org/packages/38/49/bbcb6075623e507d602398bf0c25e0e6fcfba8f7b7d38b1206b1b8e8390b/csvddata-importer-0.1.0.tar.gz",
"platform": null,
"description": "csvdata-importer\r\n================\r\n\r\nDocumentation\r\n-------------\r\n\r\nhttps://data-importer.readthedocs.io\r\n\r\n\r\nInstallation\r\n------------\r\n\r\n\r\n $ pip install csvdata-importer\r\n\r\n\r\nCSV Data Importer\r\n-----------------\r\n\r\nA configurable file to database table importer.\r\nIt can be used to import data from a csv file to a postgres\r\nor sqlite database.\r\n\r\nYou build a mapping json file and then use that to create or update tables\r\non the database.\r\n\r\n.. image:: docs/img/process.jpg\r\n :width: 250px\r\n :height: 120px\r\n :scale: 100% %\r\n :alt: the process used to import data\r\n :align: center\r\n\r\n\r\n\r\nMapping file Example\r\n--------------------\r\n\r\n.. code-block:: json\r\n\r\n {\r\n \"DATABASE_URL\": \"postgresql://user:pwd@host:5432/db\",\r\n \"TARGET_TABLE\": \"quote\",\r\n \"IF_EXISTS\": \"append\",\r\n \"COLUMN_MAPPING\": [\r\n {\r\n \"COLUMN_NAME\": \"source\",\r\n \"FILE_COLUMN_NAME\": \"source\",\r\n \"MAPPING_TYPE\": \"CONSTANT\",\r\n \"CONSTANT_VALUE\": \"test-data\"\r\n },\r\n {\r\n \"COLUMN_NAME\": \"quote_value\",\r\n \"FILE_COLUMN_NAME\": \"close\",\r\n }\r\n ]\r\n }\r\n\r\nImporting data using the mapping file\r\n-------------------------------------\r\n\r\nThe overall mapping configuration\r\n\r\n.. list-table:: Columns and their function inf the mapping file\r\n :widths: 20 30 50\r\n :header-rows: 1\r\n\r\n * - Column Name\r\n - Example\r\n - Description\r\n * - DATABASE_URL\r\n - postgresql://user:pass@host:5432/db\r\n - The database we are connecting to\r\n * - TARGET_TABLE\r\n - quote\r\n - The table in that database we are updating or creating\r\n * - FILE_PATH\r\n - /test.csv\r\n - The file we are importing\r\n * - IF_EXISTS\r\n - append\r\n - The action taken on the table if it is non empty. Can be one of fail, append.\r\n * - COLUMN_MAPPING\r\n - array of columns see next table\r\n - The columns and how they are mapped\r\n\r\nThe column mappings\r\n\r\n.. list-table:: Columns mappings\r\n :widths: 20 30 50\r\n :header-rows: 1\r\n\r\n * - Column Name\r\n - Example\r\n - Description\r\n * - COLUMN_NAME\r\n - quote_value\r\n - The table column we are updating\r\n * - FILE_COLUMN_NAME\r\n - quote\r\n - The column in the csv we are reading from\r\n * - MAPPING_TYPE\r\n - DIRECT\r\n - The type of mapping we are doing. See below\r\n * - CONSTANT_VALUE\r\n - File Import\r\n - For use when we are evaluating or mapping a constant to the table.\r\n\r\n\r\nDifferent types of mappings\r\n---------------------------\r\n\r\nDIRECT\r\nIn this case we read the value form the file and write it directly to the table row column.\r\n\r\nCONSTANT\r\nIn this case it is a constant value and we are just updating the table with the value we find in the CONSTANT_VALUE mapping.\r\n\r\nEVALUATION\r\nHere we are evaluating some code to create the data.\r\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2023 Ernan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "Supports importing files to a database using a mapping configuration.",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/ernan/csvdata-importer"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "192067a292e37e7cc846ab441befd31949a08954f65901f97aa4158c741373a5",
"md5": "92b1383b6b902a1757bd0cacce14473f",
"sha256": "a1feba29fae835804ca448bd4cd2e19c7684c2aca8077ffbf84ae615ea7fa26c"
},
"downloads": -1,
"filename": "csvddata_importer-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "92b1383b6b902a1757bd0cacce14473f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 7052,
"upload_time": "2023-10-28T13:09:49",
"upload_time_iso_8601": "2023-10-28T13:09:49.147188Z",
"url": "https://files.pythonhosted.org/packages/19/20/67a292e37e7cc846ab441befd31949a08954f65901f97aa4158c741373a5/csvddata_importer-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3849bbcb6075623e507d602398bf0c25e0e6fcfba8f7b7d38b1206b1b8e8390b",
"md5": "ef1e7f24f1364b4d206330715b1930f6",
"sha256": "61334387aa33272689bc0787aa14d0a977026ef2b7bda54f210f52afe440e14b"
},
"downloads": -1,
"filename": "csvddata-importer-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "ef1e7f24f1364b4d206330715b1930f6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 63326,
"upload_time": "2023-10-28T13:10:47",
"upload_time_iso_8601": "2023-10-28T13:10:47.473249Z",
"url": "https://files.pythonhosted.org/packages/38/49/bbcb6075623e507d602398bf0c25e0e6fcfba8f7b7d38b1206b1b8e8390b/csvddata-importer-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-28 13:10:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ernan",
"github_project": "csvdata-importer",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "pandas",
"specs": [
[
"~=",
"2.1.1"
]
]
},
{
"name": "pytest",
"specs": [
[
"~=",
"7.4.2"
]
]
},
{
"name": "psycopg2",
"specs": [
[
"~=",
"2.9.9"
]
]
},
{
"name": "SQLAlchemy",
"specs": [
[
"~=",
"2.0.22"
]
]
}
],
"lcname": "csvddata-importer"
}