# Get the sql of a preparedstatement in span details

**URL:** <https://discuss.elastic.co/t/get-the-sql-of-a-preparedstatement-in-span-details/230483>\
**Category:** APM\
**Tags:** go\
**Created:** [April 30, 2020, 7:14am UTC](https://discuss.elastic.co/t/get-the-sql-of-a-preparedstatement-in-span-details/230483 "2020-04-30T07:14:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yangfeng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yangfeng/32/67400_2.png) [@yangfeng](https://discuss.elastic.co/u/yangfeng)\
**Post date:** [April 30, 2020, 7:14am UTC](https://discuss.elastic.co/t/get-the-sql-of-a-preparedstatement-in-span-details/230483/1 "2020-04-30T07:14:31Z")

</div>

\*\*Kibana version \*\*:7.6

\*\*Elasticsearch version \*\*:7.6

**APM Server version** :7.6

\*\*APM Agent language and version \*\*: go 1.7.2

how can I get the real sql query in span detail

my code :

```auto
db, err := apmsql.Open("mysql", dataSourceName)
db.PrepareContext(context,prepareSql).QueryRowContext(context,args...).scan(dest...)

```

kibana apm trace mysql span details

```auto
select * from call_staff where id = ?

```

I want the real Sql like

```auto
select * from call_staff where id = 1

```

---

<div class="post-metadata">

**Author:** ![axw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axw/32/28197_2.png) [@axw](https://discuss.elastic.co/u/axw)\
**Post date:** [April 30, 2020, 7:35am UTC](https://discuss.elastic.co/t/get-the-sql-of-a-preparedstatement-in-span-details/230483/2 "2020-04-30T07:35:32Z")

</div>

Hi @yangfeng, welcome to the forum!

We do not capture bind variables by design, as they might contain sensitive information (passwords, credit card numbers, etc.)

There is an open issue for discussing this feature, which we would want to align across the different agents: [https://github.com/elastic/apm/issues/220](https://github.com/elastic/apm/issues/220). I suggest adding a 👍 to the issue, and subscribing for updates.

---

<div class="post-metadata">

**Author:** ![yangfeng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yangfeng/32/67400_2.png) [@yangfeng](https://discuss.elastic.co/u/yangfeng)\
**Post date:** [April 30, 2020, 8:28am UTC](https://discuss.elastic.co/t/get-the-sql-of-a-preparedstatement-in-span-details/230483/3 "2020-04-30T08:28:15Z")

</div>

ok.thank you

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 21, 2020, 4:28am UTC](https://discuss.elastic.co/t/get-the-sql-of-a-preparedstatement-in-span-details/230483/4 "2020-05-21T04:28:16Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
