{"id":13467720,"url":"https://github.com/dewscan001/python-mysql2postgresql","last_synced_at":"2025-03-26T03:31:08.852Z","repository":{"id":205947891,"uuid":"329357859","full_name":"dewscan001/python-mysql2postgresql","owner":"dewscan001","description":"Python Package transfer data from MySQL to PostgreSQL","archived":false,"fork":false,"pushed_at":"2024-07-13T00:34:43.000Z","size":21,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-01T15:10:39.974Z","etag":null,"topics":["mysql","mysql2postgresql","postgresql","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dewscan001.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-01-13T15:55:18.000Z","updated_at":"2024-07-31T13:21:36.000Z","dependencies_parsed_at":"2023-11-07T09:26:57.315Z","dependency_job_id":"8ccdbc31-9709-4763-8706-4b72efd97944","html_url":"https://github.com/dewscan001/python-mysql2postgresql","commit_stats":null,"previous_names":["dewscan001/python-mysql2postgresql"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dewscan001%2Fpython-mysql2postgresql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dewscan001%2Fpython-mysql2postgresql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dewscan001%2Fpython-mysql2postgresql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dewscan001%2Fpython-mysql2postgresql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dewscan001","download_url":"https://codeload.github.com/dewscan001/python-mysql2postgresql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222107286,"owners_count":16932450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mysql","mysql2postgresql","postgresql","python"],"created_at":"2024-07-31T15:00:59.744Z","updated_at":"2024-10-29T20:31:02.081Z","avatar_url":"https://github.com/dewscan001.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# python-mysql2postgresql\n\n## Installation - pure Python\n```\npip install python-mysql2postgresql\n```\n\n## Usage via Python file\n\n```\nfrom mysql2postgresql import mysql2postgresql\n\na = mysql2postgresql()\n\n# connect MySQL server\na.connect_mysql(\n    host='localhost',\n    port='3306',\n    user='root',\n    passwd='',\n    db='database_name'\n)\n\n# connect PostgreSQL server\na.connect_postgresql(\n    host='localhost',             \n    port=5432,\n    user='postgres',                                \n    password='postgres',                     \n    database='database_name'\n)  \n\n# shortlist of tables to copy data from -\u003e default all tables in a database\na.tables = ['table1', 'table2', ...]\n\n# shortlist of tables to exclude  -\u003e default empty\na.without = ['table3', 'table4', ...]\n\n# manual limit to query data -\u003e default 10000 \n# not limit -\u003e a.limit = 0 \na.limit = 10000\n\n# run the program\na.run()   \n\n```\n\n\n## Usage via command line\n\nYou can copy example above or create a demo.py file from example using:\n```\npython -m mysql2postgresql export_example\n```\n\nYou can convert all tables in a MySQL database to PostgreSQL using a command:\n```\npython -m mysql2postgresql convert\\\n    --mysql_host=localhost\\\n    --mysql_port=3306\\\n    --mysql_user=root\\\n    --mysql_password=\\\n    --mysql_database=db_name\\\n    --postgresql_host=localhost\\\n    --postgresql_port=5432\\\n    --postgresql_user=postgres\\\n    --postgresql_password=postgres\\\n    --postgresql_database=database_name\n```\n\nConfiguration from standard environment variables is supported reading\n$MYSQL_HOST, $MYSQL_USER, $MYSQL_PWD, $PGHOST, $PGUSER, $PGPASSWORD.\n\nWith above present you only need to add name of the database to convert.\n```\nexport CONVERT_DATABASE=mydatabase\npython -m mysql2postgresql convert\n```\n\nYou can **copy data only (without a schema)** if you already have corresponding Postgres db schema from migrations etc.\nTurning off schema creation also turns off dropping postgres tables before they get recreated.\n```\nexport CONVERT_SCHEMA=0\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdewscan001%2Fpython-mysql2postgresql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdewscan001%2Fpython-mysql2postgresql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdewscan001%2Fpython-mysql2postgresql/lists"}