Name | database-converter JSON |
Version |
0.0.7.1
JSON |
| download |
home_page | None |
Summary | None |
upload_time | 2024-09-13 08:12:00 |
maintainer | None |
docs_url | None |
author | consithe1 |
requires_python | >=3.8 |
license | MIT License Copyright (c) 2024 Constantin THEBAUDEAU 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 |
database
extraction
json
sqlite3
xml
|
VCS |
|
bugtrack_url |
|
requirements |
blackboxprotobuf
openpyxl
func_timeout
tabulate
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# database-extractor
## Description
This project intends to create a python package to extract the content of a database and convert it into a python object.
For the moment, this package can only extract the content of SQLite3 databases.
In this implementation, a row is represented as a python dictionary object.
Since the goal of this package is to extract the content of a database, BLOB fields will be decoded if possible if they
represent a protobuf or a json. In order to facilitate the data readability, nested protobuf/json objects will be converted to
unidimensional objects (cf. image below).
![Example of nested-object conversion to unidimensional object](images/transformation.png "Nested-object to unidimensional object")
## Export format
A database can be exported as a JSON or as an XML at the moment. A short exemple of both implementation is given below.
### XML
```xml
<?xml version='1.0' encoding='utf-8'?>
<database name="resources/dummy.db">
<table name="Tab1">
<row>
<column type="str" key="userId" value="C2V6" />
<column type="NoneType" key="convId" value="None" />
<column type="str" key="sent" value="0" />
</row>
</table>
<table name="Tab2">
<row>
<column type="str" key="convId" value="uaz-57" />
<column type="int" key="messageId" value="1" />
<column type="str" key="extKey" value="chat" />
</row>
<row>
<column type="str" key="convId" value="r2d-2a" />
<column type="int" key="messageId" value="3" />
<column type="str" key="extKey" value="27FwAPH4QapLXF5fhDcs7" />
</row>
<row>
<column type="str" key="convId" value="av7-dp" />
<column type="int" key="messageId" value="5" />
<column type="bytes" key="extKey" value="0000040f" />
</row>
</table>
</database>
```
### JSON
```json
{
"resources/dummy.db": {
"Tab1": [
{
"userId": {
"value": "C2V6",
"type": "str"
},
"convId": {
"value": null,
"type": "NoneType"
},
"sent": {
"value": 0,
"type": "int"
}
}
],
"Tab2": [
{
"convId": {
"value": "uaz-57",
"type": "str"
},
"messageId": {
"value": 1,
"type": "int"
},
"extKey": {
"value": "chat",
"type": "str"
}
},
{
"convId": {
"value": "r2d-2a",
"type": "str"
},
"messageId": {
"value": 3,
"type": "int"
},
"extKey": {
"value": "27FwAPH4QapLXF5fhDcs7",
"type": "str"
}
},
{
"convId": {
"value": "av7-dp",
"type": "str"
},
"messageId": {
"value": 5,
"type": "int"
},
"extKey": {
"value": "0000040f",
"type": "bytes"
}
}
]
}
}
```
## Example
```python
from database_converter.converters.sqlite3.db import SQLite3DatabaseFileConverter
import database_converter.writers.json as json
import database_converter.writers.xml as xml
if __name__ == '__main__':
# Convert the content of the database into a python object
extractor = SQLite3DatabaseFileConverter('DB1.db')
content = extractor.convert()
# Save as a XML
xml.write('extraction.xml', content)
# Save as a JSON
json.write('extraction.json', content)
```
## Features to implement
- extractors: sqlite3 WAL
Raw data
{
"_id": null,
"home_page": null,
"name": "database-converter",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "database, extraction, json, sqlite3, xml",
"author": "consithe1",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/78/77/ac399c6571981aa6932c69b1634619e54fadbb2e598132339be3db91048c/database_converter-0.0.7.1.tar.gz",
"platform": null,
"description": "# database-extractor\n\n## Description\n\nThis project intends to create a python package to extract the content of a database and convert it into a python object.\nFor the moment, this package can only extract the content of SQLite3 databases.\n\nIn this implementation, a row is represented as a python dictionary object. \n\nSince the goal of this package is to extract the content of a database, BLOB fields will be decoded if possible if they\nrepresent a protobuf or a json. In order to facilitate the data readability, nested protobuf/json objects will be converted to \nunidimensional objects (cf. image below).\n\n![Example of nested-object conversion to unidimensional object](images/transformation.png \"Nested-object to unidimensional object\")\n\n## Export format\n\nA database can be exported as a JSON or as an XML at the moment. A short exemple of both implementation is given below.\n\n### XML\n\n```xml\n<?xml version='1.0' encoding='utf-8'?>\n<database name=\"resources/dummy.db\">\n <table name=\"Tab1\">\n <row>\n <column type=\"str\" key=\"userId\" value=\"C2V6\" />\n <column type=\"NoneType\" key=\"convId\" value=\"None\" />\n <column type=\"str\" key=\"sent\" value=\"0\" />\n </row>\n </table>\n <table name=\"Tab2\">\n <row>\n <column type=\"str\" key=\"convId\" value=\"uaz-57\" />\n <column type=\"int\" key=\"messageId\" value=\"1\" />\n <column type=\"str\" key=\"extKey\" value=\"chat\" />\n </row>\n <row>\n <column type=\"str\" key=\"convId\" value=\"r2d-2a\" />\n <column type=\"int\" key=\"messageId\" value=\"3\" />\n <column type=\"str\" key=\"extKey\" value=\"27FwAPH4QapLXF5fhDcs7\" />\n </row>\n <row>\n <column type=\"str\" key=\"convId\" value=\"av7-dp\" />\n <column type=\"int\" key=\"messageId\" value=\"5\" />\n <column type=\"bytes\" key=\"extKey\" value=\"0000040f\" />\n </row>\n </table>\n</database>\n```\n\n### JSON\n\n```json\n{\n \"resources/dummy.db\": {\n \"Tab1\": [\n {\n \"userId\": {\n \"value\": \"C2V6\",\n \"type\": \"str\"\n },\n \"convId\": {\n \"value\": null,\n \"type\": \"NoneType\"\n },\n \"sent\": {\n \"value\": 0,\n \"type\": \"int\"\n }\n }\n ],\n \"Tab2\": [\n {\n \"convId\": {\n \"value\": \"uaz-57\",\n \"type\": \"str\"\n },\n \"messageId\": {\n \"value\": 1,\n \"type\": \"int\"\n },\n \"extKey\": {\n \"value\": \"chat\",\n \"type\": \"str\"\n }\n },\n {\n \"convId\": {\n \"value\": \"r2d-2a\",\n \"type\": \"str\"\n },\n \"messageId\": {\n \"value\": 3,\n \"type\": \"int\"\n },\n \"extKey\": {\n \"value\": \"27FwAPH4QapLXF5fhDcs7\",\n \"type\": \"str\"\n }\n },\n {\n \"convId\": {\n \"value\": \"av7-dp\",\n \"type\": \"str\"\n },\n \"messageId\": {\n \"value\": 5,\n \"type\": \"int\"\n },\n \"extKey\": {\n \"value\": \"0000040f\",\n \"type\": \"bytes\"\n }\n }\n ]\n }\n}\n```\n\n## Example\n\n```python\nfrom database_converter.converters.sqlite3.db import SQLite3DatabaseFileConverter\nimport database_converter.writers.json as json\nimport database_converter.writers.xml as xml\n\nif __name__ == '__main__':\n # Convert the content of the database into a python object\n extractor = SQLite3DatabaseFileConverter('DB1.db')\n content = extractor.convert()\n\n # Save as a XML\n xml.write('extraction.xml', content)\n # Save as a JSON\n json.write('extraction.json', content)\n```\n\n## Features to implement\n\n- extractors: sqlite3 WAL\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 Constantin THEBAUDEAU 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": null,
"version": "0.0.7.1",
"project_urls": {
"Repository": "https://github.com/consithe1/database_utils"
},
"split_keywords": [
"database",
" extraction",
" json",
" sqlite3",
" xml"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "67840dc332ec7df93cc57ce6811d245b235a341157059ca698971dd71c7c99ad",
"md5": "85262572586a8488695b7e11e8e566d6",
"sha256": "6cccb516dd376c053c0ea681fe1b0c606b824ec2e9d6006fe7694e4239704898"
},
"downloads": -1,
"filename": "database_converter-0.0.7.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "85262572586a8488695b7e11e8e566d6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 13729,
"upload_time": "2024-09-13T08:11:58",
"upload_time_iso_8601": "2024-09-13T08:11:58.658514Z",
"url": "https://files.pythonhosted.org/packages/67/84/0dc332ec7df93cc57ce6811d245b235a341157059ca698971dd71c7c99ad/database_converter-0.0.7.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7877ac399c6571981aa6932c69b1634619e54fadbb2e598132339be3db91048c",
"md5": "69886b604a00e9b27f13a091d905f030",
"sha256": "caf131acecff0e89d62308dafc5e1fbcf31b39a1d71da8174cc84daded099444"
},
"downloads": -1,
"filename": "database_converter-0.0.7.1.tar.gz",
"has_sig": false,
"md5_digest": "69886b604a00e9b27f13a091d905f030",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 145492,
"upload_time": "2024-09-13T08:12:00",
"upload_time_iso_8601": "2024-09-13T08:12:00.155105Z",
"url": "https://files.pythonhosted.org/packages/78/77/ac399c6571981aa6932c69b1634619e54fadbb2e598132339be3db91048c/database_converter-0.0.7.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-13 08:12:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "consithe1",
"github_project": "database_utils",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "blackboxprotobuf",
"specs": [
[
"~=",
"1.0.1"
]
]
},
{
"name": "openpyxl",
"specs": [
[
"~=",
"3.1.5"
]
]
},
{
"name": "func_timeout",
"specs": [
[
"~=",
"4.3.5"
]
]
},
{
"name": "tabulate",
"specs": [
[
"~=",
"0.9.0"
]
]
}
],
"lcname": "database-converter"
}