<jupyter_start><jupyter_text>[![AWS Data Wrangler](_static/logo.png "AWS Data Wrangler")](https://github.com/awslabs/aws-data-wrangler) 7 - Redshift, MySQL, PostgreSQL and SQL Server[Wrangler](https://github.com/awslabs/aws-data-wrangler)'s Redshift, MySQL and PostgreSQL have two basic function in common that tries to follow the Pandas conventions, but add more data type consistency.- [wr.redshift.to_sql()](https://aws-data-wrangler.readthedocs.io/en/2.11.0/stubs/awswrangler.redshift.to_sql.html)- [wr.redshift.read_sql_query()](https://aws-data-wrangler.readthedocs.io/en/2.11.0/stubs/awswrangler.redshift.read_sql_query.html)- [wr.mysql.to_sql()](https://aws-data-wrangler.readthedocs.io/en/2.11.0/stubs/awswrangler.mysql.to_sql.html)- [wr.mysql.read_sql_query()](https://aws-data-wrangler.readthedocs.io/en/2.11.0/stubs/awswrangler.mysql.read_sql_query.html)- [wr.postgresql.to_sql()](https://aws-data-wrangler.readthedocs.io/en/2.11.0/stubs/awswrangler.postgresql.to_sql.html)- [wr.postgresql.read_sql_query()](https://aws-data-wrangler.readthedocs.io/en/2.11.0/stubs/awswrangler.postgresql.read_sql_query.html)- [wr.sqlserver.to_sql()](https://aws-data-wrangler.readthedocs.io/en/2.11.0/stubs/awswrangler.sqlserver.to_sql.html)- [wr.sqlserver.read_sql_query()](https://aws-data-wrangler.readthedocs.io/en/2.11.0/stubs/awswrangler.sqlserver.read_sql_query.html)<jupyter_code>import awswrangler as wr
import pandas as pd

df = pd.DataFrame({
    "id": [1, 2],
    "name": ["foo", "boo"]
})<jupyter_output><empty_output><jupyter_text>Connect using the Glue Catalog Connections- [wr.redshift.connect()](https://aws-data-wrangler.readthedocs.io/en/2.11.0/stubs/awswrangler.redshift.connect.html)- [wr.mysql.connect()](https://aws-data-wrangler.readthedocs.io/en/2.11.0/stubs/awswrangler.mysql.connect.html)- [wr.postgresql.connect()](https://aws-data-wrangler.readthedocs.io/en/2.11.0/stubs/awswrangler.postgresql.connect.html)- [wr.sqlserver.connect()](https://aws-data-wrangler.readthedocs.io/en/2.11.0/stubs/awswrangler.sqlserver.connect.html)<jupyter_code>con_redshift = wr.redshift.connect("aws-data-wrangler-redshift")
con_mysql = wr.mysql.connect("aws-data-wrangler-mysql")
con_postgresql = wr.postgresql.connect("aws-data-wrangler-postgresql")
con_sqlserver = wr.sqlserver.connect("aws-data-wrangler-sqlserver")<jupyter_output><empty_output><jupyter_text>Raw SQL queries (No Pandas)<jupyter_code>with con_redshift.cursor() as cursor:
    for row in cursor.execute("SELECT 1"):
        print(row)<jupyter_output>[1]<jupyter_text>Loading data to Database<jupyter_code>wr.redshift.to_sql(df, con_redshift, schema="public", table="tutorial", mode="overwrite")
wr.mysql.to_sql(df, con_mysql, schema="test", table="tutorial", mode="overwrite")
wr.postgresql.to_sql(df, con_postgresql, schema="public", table="tutorial", mode="overwrite")
wr.sqlserver.to_sql(df, con_sqlserver, schema="dbo", table="tutorial", mode="overwrite")<jupyter_output><empty_output><jupyter_text>Unloading data from Database<jupyter_code>wr.redshift.read_sql_query("SELECT * FROM public.tutorial", con=con_redshift)
wr.mysql.read_sql_query("SELECT * FROM test.tutorial", con=con_mysql)
wr.postgresql.read_sql_query("SELECT * FROM public.tutorial", con=con_postgresql)
wr.sqlserver.read_sql_query("SELECT * FROM dbo.tutorial", con=con_sqlserver)
con_redshift.close()
con_mysql.close()
con_postgresql.close()
con_sqlserver.close()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16836289619075312, 'fraction_numerical': 0.015411456818842687, 'mean_word_length': 6.730337078651686, 'pattern_counts': {'":': 2, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '88210', 'license': 'Apache-2.0', 'n_tokens_mistral': 1400, 'n_tokens_neox': 1341, 'n_words': 133, 'path': 'tutorials/007 - Redshift, MySQL, PostgreSQL, SQL Server.ipynb', 'repo_name': 'arm-diaz/aws-data-wrangler', 'size': '3439'}