# simple-transfer
Easy data transfers between relational databases. Specify the source/destination connection, schema, and table and simple-transfer does the rest.
# Quickstart
```python
import logging
from simple_transfer import MySQLConnection, Pipeline, PostgreSQLConnection
logging.basicConfig(level=logging.INFO)
source_connection = PostgreSQLConnection(
host="source-database.xxx.us-east-1.rds.amazonaws.com",
port=5432,
username="<username>",
password="<password>",
db="postgres",
)
destination_connection = MySQLConnection(
host="destination-database.xxx.us-east-1.rds.amazonaws.com",
port=3306,
username="<username>",
password="<password>",
db="my_db",
)
pipeline = Pipeline(
source_connection=source_connection,
source_schema="public",
source_table="source_table",
destination_connection=destination_connection,
destination_schema="my_db",
destination_table="destination_table",
inject_mode="swap",
)
pipeline.execute()
```
# Supported Databases
- PostgreSQL
- MySQL
# Supported temporary storage locations
This package utilizes the [`smart_open`](https://github.com/RaRe-Technologies/smart_open) package when opening a file object, this enables the intermediate storage location to be anything supported by this library:
- Local File System
- AWS S3
- Azure Blob Storage
- GCP Cloud Storage
# Injection Methods
## overwrite
This mode will drop and recreate the table if it exists before inserting the data into it.
## append
This mode will create the table if it doesn't exist, and then insert the data into it.
## swap
This mode will create a swap table and insert the data into it. Then in a transaction it will swap the names of the swap table and existing table and then drop the now renamed existing table.
Raw data
{
"_id": null,
"home_page": "https://github.com/henryivesjones/simple-transfer",
"name": "simple-transfer",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "pipeline,postgresql,mysql,data-transfer,relational,data",
"author": "Henry Jones",
"author_email": "Henry Jones <henryivesjones@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/36/b1/d626a6ba8efa43524ffccf7f4dd76796f08a92270deafbf9de699fe4d8ae/simple-transfer-0.1.1.tar.gz",
"platform": null,
"description": "# simple-transfer\nEasy data transfers between relational databases. Specify the source/destination connection, schema, and table and simple-transfer does the rest.\n\n# Quickstart\n```python\nimport logging\n\nfrom simple_transfer import MySQLConnection, Pipeline, PostgreSQLConnection\n\nlogging.basicConfig(level=logging.INFO)\n\n\nsource_connection = PostgreSQLConnection(\n host=\"source-database.xxx.us-east-1.rds.amazonaws.com\",\n port=5432,\n username=\"<username>\",\n password=\"<password>\",\n db=\"postgres\",\n)\n\ndestination_connection = MySQLConnection(\n host=\"destination-database.xxx.us-east-1.rds.amazonaws.com\",\n port=3306,\n username=\"<username>\",\n password=\"<password>\",\n db=\"my_db\",\n)\n\npipeline = Pipeline(\n source_connection=source_connection,\n source_schema=\"public\",\n source_table=\"source_table\",\n destination_connection=destination_connection,\n destination_schema=\"my_db\",\n destination_table=\"destination_table\",\n inject_mode=\"swap\",\n)\npipeline.execute()\n\n\n```\n\n# Supported Databases\n - PostgreSQL\n - MySQL\n\n# Supported temporary storage locations\nThis package utilizes the [`smart_open`](https://github.com/RaRe-Technologies/smart_open) package when opening a file object, this enables the intermediate storage location to be anything supported by this library:\n - Local File System\n - AWS S3\n - Azure Blob Storage\n - GCP Cloud Storage\n\n# Injection Methods\n## overwrite\nThis mode will drop and recreate the table if it exists before inserting the data into it.\n## append\nThis mode will create the table if it doesn't exist, and then insert the data into it.\n## swap\nThis mode will create a swap table and insert the data into it. Then in a transaction it will swap the names of the swap table and existing table and then drop the now renamed existing table.\n",
"bugtrack_url": null,
"license": "",
"summary": "A tool for moving data between relational databases.",
"version": "0.1.1",
"split_keywords": [
"pipeline",
"postgresql",
"mysql",
"data-transfer",
"relational",
"data"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c8a61820d62b6785630fd3e4172c6ca3b6c4443a8bb298eecb876f59634df480",
"md5": "b7c74c015c79b282e3b0b75c555eeb38",
"sha256": "4463b163d20ea9eb5543a2100915857935f2c885a1fd102df2d47cd7c1619664"
},
"downloads": -1,
"filename": "simple_transfer-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b7c74c015c79b282e3b0b75c555eeb38",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 25361,
"upload_time": "2023-01-23T17:35:46",
"upload_time_iso_8601": "2023-01-23T17:35:46.673956Z",
"url": "https://files.pythonhosted.org/packages/c8/a6/1820d62b6785630fd3e4172c6ca3b6c4443a8bb298eecb876f59634df480/simple_transfer-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "36b1d626a6ba8efa43524ffccf7f4dd76796f08a92270deafbf9de699fe4d8ae",
"md5": "da7229ce248c44464c1c32045a1eeca6",
"sha256": "9663c17f850fbbac8cf372904e7902778ab6a516e69543231d549752e373fbae"
},
"downloads": -1,
"filename": "simple-transfer-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "da7229ce248c44464c1c32045a1eeca6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 21220,
"upload_time": "2023-01-23T17:35:48",
"upload_time_iso_8601": "2023-01-23T17:35:48.640339Z",
"url": "https://files.pythonhosted.org/packages/36/b1/d626a6ba8efa43524ffccf7f4dd76796f08a92270deafbf9de699fe4d8ae/simple-transfer-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-23 17:35:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "henryivesjones",
"github_project": "simple-transfer",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "psycopg2",
"specs": []
},
{
"name": "smart_open",
"specs": []
},
{
"name": "mysql-connector-python",
"specs": []
}
],
"lcname": "simple-transfer"
}