From 1e6b9e24cb3d74b006e15848c5df395ed173db42 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Mon, 8 Jun 2026 16:32:50 +0200 Subject: [PATCH 1/2] feat: Add aiomysql integration page --- .../python/integrations/aiomysql/index.mdx | 85 +++++++++++++++++++ docs/platforms/python/integrations/index.mdx | 1 + 2 files changed, 86 insertions(+) create mode 100644 docs/platforms/python/integrations/aiomysql/index.mdx diff --git a/docs/platforms/python/integrations/aiomysql/index.mdx b/docs/platforms/python/integrations/aiomysql/index.mdx new file mode 100644 index 0000000000000..cf20011e3bf23 --- /dev/null +++ b/docs/platforms/python/integrations/aiomysql/index.mdx @@ -0,0 +1,85 @@ +--- +title: aiomysql +description: "Learn about importing the aiomysql integration and how it captures queries from aiomysql as spans." +--- + +The aiomysql integration captures queries from [aiomysql](https://github.com/aio-libs/aiomysql/) as spans. + +## Install + +Install `sentry-sdk` from PyPI: + +```bash {tabTitle:pip} +pip install sentry-sdk +``` +```bash {tabTitle:uv} +uv add sentry-sdk +``` + +## Configure + +Add `AioMySQLIntegration()` to your `integrations` list: + +```python +import sentry_sdk +from sentry_sdk.integrations.aiomysql import AioMySQLIntegration + +sentry_sdk.init( + dsn="___PUBLIC_DSN___", + # Set traces_sample_rate to 1.0 to capture 100% + # of transactions for tracing. + traces_sample_rate=1.0, + # Add data like inputs and responses; + # see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info + send_default_pii=True, + integrations=[ + AioMySQLIntegration(), + ], +) +``` + +## Verify + +```python +import sentry_sdk +from sentry_sdk.integrations.aiomysql import AioMySQLIntegration +import aiomysql +import asyncio + +sentry_sdk.init( + dsn="___PUBLIC_DSN___", + traces_sample_rate=1.0, + send_default_pii=True, + integrations=[ + AioMySQLIntegration(), + ], +) + +async def main(): + conn = await aiomysql.connect( + host="localhost", + port=3306, + user="root", + password="root", + db="test", + ) + try: + with sentry_sdk.start_transaction(name="testing_sentry"): + async with conn.cursor() as cur: + await cur.execute("SELECT 'Hello World'") + result = await cur.fetchone() + finally: + conn.close() + +asyncio.run(main()) +``` + +This will create a transaction called `testing_sentry` in the Performance section of [sentry.io](https://sentry.io) and will create a span for the `SELECT` statement. + +It takes a couple of moments for the data to appear in [sentry.io](https://sentry.io). + +## Supported Versions + +- aiomysql: 0.3+ + + diff --git a/docs/platforms/python/integrations/index.mdx b/docs/platforms/python/integrations/index.mdx index ad8f9c42fbebc..6e5494b5c5be9 100644 --- a/docs/platforms/python/integrations/index.mdx +++ b/docs/platforms/python/integrations/index.mdx @@ -31,6 +31,7 @@ The Sentry SDK uses integrations to hook into the functionality of popular libra | | **Auto-enabled** | | -------------------------------------------------------------------------------------------------------------------------------------- | :--------------: | +| | ✓ | | | ✓ | | | ✓ | | | ✓ | From 7c5e69ae4d2a9b0763b5c758e111f912550fb960 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Mon, 8 Jun 2026 16:49:58 +0200 Subject: [PATCH 2/2] remove auto-enabling --- docs/platforms/python/integrations/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/python/integrations/index.mdx b/docs/platforms/python/integrations/index.mdx index 6e5494b5c5be9..4e3c37ddb73bf 100644 --- a/docs/platforms/python/integrations/index.mdx +++ b/docs/platforms/python/integrations/index.mdx @@ -31,7 +31,7 @@ The Sentry SDK uses integrations to hook into the functionality of popular libra | | **Auto-enabled** | | -------------------------------------------------------------------------------------------------------------------------------------- | :--------------: | -| | ✓ | +| | | | | ✓ | | | ✓ | | | ✓ |