# How to do parameterized query using slick

**URL:** <https://discuss.akka.io/t/how-to-do-parameterized-query-using-slick/2679>\
**Category:** Akka Streams & Alpakka\
**Tags:** slick\
**Created:** [November 9, 2018, 7:47pm UTC](https://discuss.akka.io/t/how-to-do-parameterized-query-using-slick/2679 "2018-11-09T19:47:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![riyadparvez](https://avatars.discourse-cdn.com/v4/letter/r/76d3ee/32.png) [@riyadparvez](https://discuss.akka.io/u/riyadparvez)\
**Post date:** [November 9, 2018, 7:47pm UTC](https://discuss.akka.io/t/how-to-do-parameterized-query-using-slick/2679/1 "2018-11-09T19:47:32Z")

</div>

In Java examples of slick-alpakka it was shown Create, Update, Delete using stream. However I couldn’t find any example of using read where the SQL query is paramterized.

For example, " ```

```auto
final CompletionStage<Done> done =
    Slick.source(
            session,
            "SELECT ID, NAME FROM ALPAKKA_SLICK_JAVADSL_TEST_USERS",
            (SlickRow row) -> new User(row.nextInt(), row.nextString()))
        .log("user")
        .runWith(Sink.ignore(), materializer);

```

```auto

works just fine. But what if I want to parameterize the qeuery with 
`"SELECT ID, NAME FROM ALPAKKA_SLICK_JAVADSL_TEST_USERS WHERE ID = " + id;`

where the `id` will come as an input. How to achieve this using slick-alpakka?
```

---

<div class="post-metadata">

**Author:** ![ennru](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/ennru/32/1495_2.png) [@ennru](https://discuss.akka.io/u/ennru)\
**Post date:** [November 14, 2018, 7:35am UTC](https://discuss.akka.io/t/how-to-do-parameterized-query-using-slick/2679/2 "2018-11-14T07:35:59Z")

</div>

The Alpakka Slick connector does not support reading from the database in a flow.

I assume you look for something like

```auto
Flow[Parameters, Result] slickReadFlow

```

which uses values in `Parameters` to populate query parameters.

It is not there today, but it makes sense to add such a flow.

Contributions welcome!
