Dynamic hintOptions

I have the following to initialize my codemirror instance,

	var editor = CodeMirror.fromTextArea(
		document.getElementById("editor"), 
		{
			mode: "sql",
			//theme: "colorforth",
			lineNumbers: true,
			lineWrapping: true,
			styleActiveLine: true,
			autoCloseBrackets: true,
			viewportMargin: Infinity,
			highlightSelectionMatches: {showToken: /\w/, annotateScrollbar: true},
			extraKeys: {"Ctrl-Space": "autocomplete"}, // To invoke the auto complete
			hint: CodeMirror.hint.sql,
			hintOptions: {
				tables: {
					"table1": [ "col_A", "col_B", "col_C" ],
					"table2": [ "other_columns1", "other_columns2" ]
				},
			},
		}
	); 

but need to be able to change the hintOptions tables on the fly. I’ve tried

	function changeHintOptions(){
		var options = {tables : {"k":["field1", "col2"], "kk":["asc", "bdef"]}};
		editor.setOption("hintOptions", options);
	}
	changeHintOptions();

but it doesn’t seem to work/take effect. Could anyone advise me on how I can do this.

I think you need to format it this way:

var options = {
    tables : {
      "k": "field1", 
      "k": "col2", 
      "kk": "asc", 
      "kk": "bdef"
    }
};