# Using multiple bindings It's easy to use more than one database in your reports. Here's an example. In my office I have two consoles: a VantagePro2 connected to a Dell Optiplex, and a WMR100N, connected to a Raspberry Pi. Each is running WeeWX. The Dell is using SQLite, the RPi, MySQL. Suppose I wish to compare the inside temperatures of the two consoles. How would I do that? It's easier to access MySQL across a network than SQLite, so let's run the reports on the Dell, but access the RPi's MySQL database remotely. Here's how the bindings and database sections of `weewx.conf` would look on the Dell: ``` ini hl_lines="14-22 31-34" [DataBindings] # This section binds a data store to an actual database [[wx_binding]] # The database to be used - it should match one of the sections in [Databases] database = archive_sqlite # The name of the table within the database table_name = archive # The class to manage the database manager = weewx.manager.DaySummaryManager # The schema defines the structure of the database contents schema = weewx.schemas.wview_extended.schema [[wmr100_binding]] # Binding for my WMR100 on the RPi database = rpi_mysql # The name of the table within the database table_name = archive # The class to manage the database manager = weewx.manager.DaySummaryManager # The schema defines to structure of the database contents schema = weewx.schemas.wview_extended.schema [Databases] # This section binds to the actual database to be used [[archive_sqlite]] database_type = SQLite database_name = weewx.sdb [[rpi_mysql]] database_type = MySQL database_name = weewx host = rpi-bug [DatabaseTypes] # This section defines defaults for the different types of databases. [[SQLite]] driver = weedb.sqlite # Directory in which the database files are located SQLITE_ROOT = archive [[MySQL]] driver = weedb.mysql # The host where the database is located host = localhost # The user name for logging in to the host user = weewx # The password for the user name password = weewx ``` The two additions have been ==highlighted==. The first, `[[wmr100_binding]]`, adds a new binding called `wmr100_binding`. It links ("binds") to the new database, called `rpi_mysql`, through the option `database`. It also defines some characteristics of the binding, such as which manager is to be used and what its schema looks like. The second addition, `[[rpi-mysql]]`, defines the new database. Option `database_type` is set to `MySQL`, indicating that it is a MySQL database. Defaults for MySQL databases are defined in the section `[[MySQL]]`. The new database accepts all of them, except for `host`, which as been set to the remote host `rpi-bug`, the name of my Raspberry Pi. ## Explicit binding in tags How do we use this new binding? First, let's do a text comparison, using tags. Here's what our template looks like: ``` html hl_lines="8"
| Inside Temperature, Vantage | $current.inTemp |
| Inside Temperature, WMR100 | $latest($data_binding='wmr100_binding').inTemp |