# Send data to multiple tables of same database

**URL:** https://community.influxdata.com/t/send-data-to-multiple-tables-of-same-database/15883
**Category:** Systems
**Created:** [September 7, 2020, 11:16am UTC](https://community.influxdata.com/t/send-data-to-multiple-tables-of-same-database/15883 "2020-09-07T11:16:30Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Aritra666B](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@Aritra666B](https://community.influxdata.com/u/Aritra666B)
#### Post date: [September 7, 2020, 11:16am UTC](https://community.influxdata.com/t/send-data-to-multiple-tables-of-same-database/15883/1 "2020-09-07T11:16:30Z")

</div>

Hi guys,

Am new to Influxdb & telegraf connections. Currently am trying to send data to multiple tables of the same database via telegraf & MQTT but I couldn’t find any help on this. So far I can send one data to a single table. How to send multiple data to multiple tables?

My code is below

```
###############################################################################
# OUTPUT PLUGINS #
###############################################################################

# Configuration for influxdb server to send metrics to
[[outputs.influxdb_v2]]
  ## The full HTTP or UDP endpoint URL for your InfluxDB instance.
  ## Multiple urls can be specified as part of the same cluster,
  ## this means that only ONE of the urls will be written to each interval.
  # urls = ["udp://localhost:8089"] # UDP endpoint example
  #urls = ["http://localhost:8086"] # required
  urls = ["http://127.0.0.1:8086"]
  ## The target database for metrics (telegraf will create it if not exists).
  database = "mqtt-telegraf-db" # required

  ## Retention policy to write to. Empty string writes to the default rp.
  retention_policy = ""
  ## Write consistency (clusters only), can be: "any", "one", "quorum", "all"
  write_consistency = "any"

  ## Write timeout (for the InfluxDB client), formatted as a string.
  ## If not provided, will default to 5s. 0s means no timeout (not recommended).
  timeout = "10s"
  # username = "telegraf"
  # password = "pwd"
  ## Set the user agent for HTTP POSTs (can be useful for log differentiation)
  # user_agent = "telegraf"
  ## Set UDP payload size, defaults to InfluxDB UDP Client default (512 bytes)
  # udp_payload = 1024

  ## Optional SSL Config
  # ssl_ca = "/etc/telegraf/ca.pem"
  # ssl_cert = "/etc/telegraf/cert.pem"
  # ssl_key = "/etc/telegraf/key.pem"
  ## Use SSL but skip chain & host verification
  # insecure_skip_verify = false

###############################################################################
# INPUT PLUGINS #
###############################################################################

# Read metrics from MQTT topic(s)
[[inputs.mqtt_consumer]]
  servers = ["localhost:1883"]
  
  ## MQTT QoS, must be 0, 1, or 2
  qos = 0

  ## Topics to subscribe to
  topics = [
    "Lenze",
    "LACC"
  ]

  # if true, messages that can't be delivered while the subscriber is offline
  # will be delivered when it comes back (such as on service restart).
  # NOTE: if true, client_id MUST be set
  persistent_session = false
  # If empty, a random client ID will be generated.
  client_id = ""

  ## username and password to connect MQTT server.
  # username = "telegraf"
  # password = "pwd"

  data_format = "json"
```

---

<div class="post-metadata">

### Author: ![mhall119](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/mhall119/32/3898_2.png) [@mhall119](https://community.influxdata.com/u/mhall119)
#### Post date: [September 8, 2020, 4:49pm UTC](https://community.influxdata.com/t/send-data-to-multiple-tables-of-same-database/15883/2 "2020-09-08T16:49:52Z")

</div>

If you are using an InfluxDB 2.0 database (or InfluxDB Cloud 2) you should have `bucket`, `org` and `token` in your `[outputs.influxdb_v2]` section, not `database` and `retention_policy`.

See [telegraf/plugins/outputs/influxdb\_v2 at master · influxdata/telegraf · GitHub](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/influxdb_v2)
