I am pulling data from a database that has fields populated with numeric values. I need to perform subsequent lookups to additional tables to convert the numeric value to a named value. Since I'll be doing this frequently, I wanted to minimize the number of SQL calls which it looks like the JDBC static filter would allow me to do?
I've configured the loaders fine but I have a couple questions regarding the local_db_objects and local lookups.
- I don't understand the purpose of the
index_columns
setting, is this like the table's primary key? - Do local queries have to be specified in the same call of the filter or can they be specified later. For instance, does this work?
filter {
jdbc_static {
loaders => [
{
query => "SELECT id,value FROM Contact"
local_table => "contact_type"
}
]
}
local_db_objects => [
{
name => "contact_type"
index_columns => [id]
columns => [
[ "id", "SMALLINT" ],
[ "value", "varchar(20)" ]
]
}
]
}
if [contact] {
jdbc_static {
local_lookups => [
{
query => "select name from contact_type WHERE value = :contact"
target => "contact"
}
]
}
}
}