•The unique_idx_name_on_key  field is set to PRIMARY , which refers to the primary index defined on the unique country  column in the multicol  table. 

3. Copy the sample Python application into a file. In this example, the sample script is copied to a file named multicol.py . 

The sample Python application inserts data into the multicol  table and retrieves data for all keys, demonstrating how to access an InnoDB  table through the daemon_memcached  plugin. 

import sys, os import memcache def connect_to_memcached(): memc = memcache.Client([’127.0.0.1:11211’], debug=0); print "Connected to memcached." return memc def banner(message): print print "=" * len(message) print message print "=" * len(message) country_data = [ ("Canada","34820000","9984670","R"), ("USA","314242000","9826675","R"), ("Ireland","6399152","84421","L"), ("UK","62262000","243610","L"), ("Mexico","113910608","1972550","R"), ("Denmark","5543453","43094","R"), ("Norway","5002942","385252","R"), ("UAE","8264070","83600","R"), ("India","1210193422","3287263","L"), ("China","1347350000","9640821","R"), ] def switch_table(memc,table): key = "@@" + table print "Switching default table to ’" + table + "’ by issuing GET for ’" + key + "’." result = memc.get(key) def insert_country_data(memc): banner("Inserting initial data via memcached interface") for item in country_data: country = item[0] population = item[1] area = item[2] drive_side = item[3] key = country value = "|".join([population,area,drive_side]) print "Key = " + key print "Value = " + value if memc.add(key,value): print "Added new key, value pair." else: print "Updating value for existing key." memc.set(key,value) def query_country_data(memc): banner("Retrieving data for all keys (country names)") for item in country_data: key = item[0] result = memc.get(key) 

