pycsvtosqliteroh


Namepycsvtosqliteroh JSON
Version 0.0.1 PyPI version JSON
download
home_pageNone
SummaryA python module for converting csv files to sqlite and back.
upload_time2024-05-05 19:26:59
maintainerIT-Administrators
docs_urlNone
authorIT-Administrators
requires_python>=3.7
licenseMIT License Copyright (c) 2024 IT-Administrators 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 csv sqlite converting
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![CI](https://github.com/IT-Administrators/pycsvtosqliteroh/actions/workflows/ci.yaml/badge.svg)](https://github.com/IT-Administrators/pycsvtosqliteroh/actions/workflows/ci.yaml)

# pycsvtosqliteroh

_The pycsvtosqliteroh module is a module to convert csv to sqlite and back._

## Table of contents

1. [Introduction](#introduction)
2. [Getting started](#getting-started)
    1. [Prerequisites](#prerequisites)
    2. [Installation](#installation)
3. [How to use](#how-to-use)
    1. [How to import](#how-to-import)
    2. [Using the module](#using-the-module)
    3. [Using the cli](#using-the-cli)
4. [Releasing](#releasing)
5. [License](/LICENSE)

## Introduction

I've written this module to bulk convert csv files into sqlite tables. The database is used as a test database in another project.

The supported delimiters for the .csv file are "," and ";". 

All testfiles in the [testfiles](/tests/testfiles/) folder, are created via powershell, using the ```Export-Csv``` cmdlet with different delimiters.

You can now convert csv to sqlite as well as sqlite to csv. 
When exporting a sqlite table to .csv
the delimiter is "," by default.

## Getting started

### Prerequisites

- Python installed
- Operatingsystem: Linux or Windows, not tested on mac
- IDE like VS Code, if you want to contribute or change the code

### Installation

There are two ways to install this module depending on the way you work and the preinstalled modules:

1. ```pip install pycsvtosqliteroh```
2. ```python -m pip install pycsvtosqliteroh```

## How to use

### How to Import

You can import the module in two ways:

```python
import pycsvtosqliteroh
```

- This will import all functions. Even the ones that are not supposed to be used (helper functions).

```python
from pycsvtosqliteroh import *
```

- This will import only the significant functions, meant for using. 

### Using the module

Depending on the way you imported the module, the following examples look a bit different.

Example 1: Converting csv to sqlite.

```python
# Import module.
from pycsvtosqliteroh import *
# Create object and than convert to sqlite table.
csvobj = CsvToSqlite(file, database)
csvobj.create_table_from_csv()
```

Example 2: Converting sqlite table to csv file.

```python
# Import module.
from pycsvtosqliteroh import *
# Create object and than convert to .csv file.
sqliteobj = SqliteToCsv(file, database, tablename)
sqliteobj.convert_table_to_csv()
```

### Using the cli

To show the help run the following command:

```python
python -m pycsvtosqliteroh.main -h
```
Result:
```
usage: __main__.py [-h] [-file FILE] [-db DATABASE] [-table TABLENAME]

options:
  -h, --help            show this help message and exit

CsvToSqlite:
  -file FILE, --file FILE
                        Csv file that will be converted.
  -db DATABASE, --database DATABASE
                        Sqlite database.
  -table TABLENAME, --tablename TABLENAME
                        Sqlite table.
```

Using the conversion:

Converts a .csv file to a sqlite table:

```python
python -m pycsvtosqliteroh --file "Filename" --database "TestDb.sqlite"
```

Converts a sqlite table to a .csv file:
```python
python -m pycsvtosqliteroh --file "NewFileCreated" --database "TestDb.sqlite" --table "Tablename"
```
## Releasing

Releases are published automatically when a tag is pushed to GitHub.

```Powershell
# Create release variable.
$Release = "x.x.x"
# Create commit.
git commit --allow-empty -m "Release $Release"
# Create tag.
git tag -a $Release -m "Version $Release"
# Push from original.
git push origin --tags
# Push from fork.
git push upstream --tags
```

## License

[MIT](/LICENSE)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pycsvtosqliteroh",
    "maintainer": "IT-Administrators",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "csv, sqlite, converting",
    "author": "IT-Administrators",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/5a/d0/cad804aa02ab25d6a6ca57d90862d3de0a9965cf38098dded175ad463957/pycsvtosqliteroh-0.0.1.tar.gz",
    "platform": null,
    "description": "[![CI](https://github.com/IT-Administrators/pycsvtosqliteroh/actions/workflows/ci.yaml/badge.svg)](https://github.com/IT-Administrators/pycsvtosqliteroh/actions/workflows/ci.yaml)\r\n\r\n# pycsvtosqliteroh\r\n\r\n_The pycsvtosqliteroh module is a module to convert csv to sqlite and back._\r\n\r\n## Table of contents\r\n\r\n1. [Introduction](#introduction)\r\n2. [Getting started](#getting-started)\r\n    1. [Prerequisites](#prerequisites)\r\n    2. [Installation](#installation)\r\n3. [How to use](#how-to-use)\r\n    1. [How to import](#how-to-import)\r\n    2. [Using the module](#using-the-module)\r\n    3. [Using the cli](#using-the-cli)\r\n4. [Releasing](#releasing)\r\n5. [License](/LICENSE)\r\n\r\n## Introduction\r\n\r\nI've written this module to bulk convert csv files into sqlite tables. The database is used as a test database in another project.\r\n\r\nThe supported delimiters for the .csv file are \",\" and \";\". \r\n\r\nAll testfiles in the [testfiles](/tests/testfiles/) folder, are created via powershell, using the ```Export-Csv``` cmdlet with different delimiters.\r\n\r\nYou can now convert csv to sqlite as well as sqlite to csv. \r\nWhen exporting a sqlite table to .csv\r\nthe delimiter is \",\" by default.\r\n\r\n## Getting started\r\n\r\n### Prerequisites\r\n\r\n- Python installed\r\n- Operatingsystem: Linux or Windows, not tested on mac\r\n- IDE like VS Code, if you want to contribute or change the code\r\n\r\n### Installation\r\n\r\nThere are two ways to install this module depending on the way you work and the preinstalled modules:\r\n\r\n1. ```pip install pycsvtosqliteroh```\r\n2. ```python -m pip install pycsvtosqliteroh```\r\n\r\n## How to use\r\n\r\n### How to Import\r\n\r\nYou can import the module in two ways:\r\n\r\n```python\r\nimport pycsvtosqliteroh\r\n```\r\n\r\n- This will import all functions. Even the ones that are not supposed to be used (helper functions).\r\n\r\n```python\r\nfrom pycsvtosqliteroh import *\r\n```\r\n\r\n- This will import only the significant functions, meant for using. \r\n\r\n### Using the module\r\n\r\nDepending on the way you imported the module, the following examples look a bit different.\r\n\r\nExample 1: Converting csv to sqlite.\r\n\r\n```python\r\n# Import module.\r\nfrom pycsvtosqliteroh import *\r\n# Create object and than convert to sqlite table.\r\ncsvobj = CsvToSqlite(file, database)\r\ncsvobj.create_table_from_csv()\r\n```\r\n\r\nExample 2: Converting sqlite table to csv file.\r\n\r\n```python\r\n# Import module.\r\nfrom pycsvtosqliteroh import *\r\n# Create object and than convert to .csv file.\r\nsqliteobj = SqliteToCsv(file, database, tablename)\r\nsqliteobj.convert_table_to_csv()\r\n```\r\n\r\n### Using the cli\r\n\r\nTo show the help run the following command:\r\n\r\n```python\r\npython -m pycsvtosqliteroh.main -h\r\n```\r\nResult:\r\n```\r\nusage: __main__.py [-h] [-file FILE] [-db DATABASE] [-table TABLENAME]\r\n\r\noptions:\r\n  -h, --help            show this help message and exit\r\n\r\nCsvToSqlite:\r\n  -file FILE, --file FILE\r\n                        Csv file that will be converted.\r\n  -db DATABASE, --database DATABASE\r\n                        Sqlite database.\r\n  -table TABLENAME, --tablename TABLENAME\r\n                        Sqlite table.\r\n```\r\n\r\nUsing the conversion:\r\n\r\nConverts a .csv file to a sqlite table:\r\n\r\n```python\r\npython -m pycsvtosqliteroh --file \"Filename\" --database \"TestDb.sqlite\"\r\n```\r\n\r\nConverts a sqlite table to a .csv file:\r\n```python\r\npython -m pycsvtosqliteroh --file \"NewFileCreated\" --database \"TestDb.sqlite\" --table \"Tablename\"\r\n```\r\n## Releasing\r\n\r\nReleases are published automatically when a tag is pushed to GitHub.\r\n\r\n```Powershell\r\n# Create release variable.\r\n$Release = \"x.x.x\"\r\n# Create commit.\r\ngit commit --allow-empty -m \"Release $Release\"\r\n# Create tag.\r\ngit tag -a $Release -m \"Version $Release\"\r\n# Push from original.\r\ngit push origin --tags\r\n# Push from fork.\r\ngit push upstream --tags\r\n```\r\n\r\n## License\r\n\r\n[MIT](/LICENSE)\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 IT-Administrators  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": "A python module for converting csv files to sqlite and back.",
    "version": "0.0.1",
    "project_urls": {
        "Homepage": "https://github.com/IT-Administrators/pycsvtosqliteroh"
    },
    "split_keywords": [
        "csv",
        " sqlite",
        " converting"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c50f7feccdbbafa6ce60f2004da5d305f9e123d4cfba2f899b370b4a81b7720d",
                "md5": "5459fab59e55af365381cf3c59b0d1cc",
                "sha256": "b30e9351c5a90cfd0584fa7a7fa8d3e9655b3a6c9753048256b867c65b1d87ef"
            },
            "downloads": -1,
            "filename": "pycsvtosqliteroh-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5459fab59e55af365381cf3c59b0d1cc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 6959,
            "upload_time": "2024-05-05T19:26:58",
            "upload_time_iso_8601": "2024-05-05T19:26:58.649654Z",
            "url": "https://files.pythonhosted.org/packages/c5/0f/7feccdbbafa6ce60f2004da5d305f9e123d4cfba2f899b370b4a81b7720d/pycsvtosqliteroh-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5ad0cad804aa02ab25d6a6ca57d90862d3de0a9965cf38098dded175ad463957",
                "md5": "690efd7d87e5ad3e2833cdd1df23ed8d",
                "sha256": "5e336e22e06d934bdc3cf14cdfeb4f73aaaf623da6f5f7dba22fec6228f8ba34"
            },
            "downloads": -1,
            "filename": "pycsvtosqliteroh-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "690efd7d87e5ad3e2833cdd1df23ed8d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 7472,
            "upload_time": "2024-05-05T19:26:59",
            "upload_time_iso_8601": "2024-05-05T19:26:59.834117Z",
            "url": "https://files.pythonhosted.org/packages/5a/d0/cad804aa02ab25d6a6ca57d90862d3de0a9965cf38098dded175ad463957/pycsvtosqliteroh-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-05 19:26:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "IT-Administrators",
    "github_project": "pycsvtosqliteroh",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "pycsvtosqliteroh"
}
        
Elapsed time: 0.21350s