To not be able to use uppercase-letters in column names for schema settings to the table.
Schemas currently support column names consisting of lowercase alphabets, numbers, and "_" only. http://docs.treasuredata.com/articles/schema#setting-custom-schema
If you used uppercase-letters for column name, you need to re-import to table now.
We provide a way to re-import to table.
- To get column names.
SELECT
*
FROM
(TABLE)
LIMIT 1
After that, you could get data: v:map<string,string>, time:int
- To download json file, and edit the json file.
["v","time"]
[{"id":"hi","time":"1334102460"},1334102460]
please delete some parts like following line for a script
{"id":"hi","time":"1334102460"}
- To rewrite <job_id> and <table_name>, and then run the following script as Ruby.
# encoding: utf-8
require 'json'
header = JSON.parse(File.read("<job_id>.json", :encoding=>"UTF-8"))
db = "dbname"
table = "<table_name>"
cnt = 0
puts "-- #{db}.#{table}"
puts "SELECT "
header.each_key do |key|
cnt += 1
puts "v['#{key}'] AS #{key.downcase}," if key != 'time' and cnt != header.length
puts "v['#{key}'] AS #{key.downcase}" if key != 'time' and cnt == header.length
puts "#{key} AS #{key.downcase}," if key == 'time' and cnt != header.length
puts "#{key} AS #{key.downcase}" if key == 'time' and cnt == header.length
end
puts "FROM #{table}"
You can get a query to change letter from upper to lower.
-
To run the query and To output to table on TD
-
After that, to execute the following command.
$ td table:swap <db> <previous_table> <result_output_table>