using a variable as a key to a dictionary

With jinja2, is it possible to use a variable as a key to a dictionary?
The following doesn't work:

var file:
db_names:
  - prod
  - dev
  - qa

databases:
  prod:
    connection_string: prod_conn_string
  qa:
    connection_string: qa_conn_string
  dev:
    connection_string: dev_conn_string

playbook:
- name: test
  debug: msg="database conn string: {{ databases.{{item}}.connection_string }}
  with_items: db_names

Got it (from http://jinja.pocoo.org/docs/templates, right in "Variables"):
- name: test
  debug: msg="database conn string: {{ databases[item].connection_string }}
  with_items: db_names