Epoch to timeformat 'YYYY-MM-DD HH:MI:SS' while redshift copy

风格不统一 提交于 2019-12-22 07:02:53

问题


Is there any way to format the epoch to timeformat 'YYYY-MM-DD HH:MI:SS' while doing redshift copy from s3 to redshift using COPY command


回答1:


You can use redshift COPY command with parameter TIMEFORMAT 'epochsecs' or TIMEFORMAT 'epochmillisecs' Check redshift documentation for more details




回答2:


Sample COPY query using javascript miliseconds (13 digits): Possible options in documentation

COPY "hits" FROM 's3://your-bucket/your_folder/'
      CREDENTIALS 'aws_access_key_id=<AWS_ACCESS_KEY_ID>;aws_secret_access_key=<AWS_SECRET_ACCESS_KEY>'
      FORMAT as JSON 's3://your-bucket/config/jsonpaths'
      TIMEFORMAT as 'epochmillisecs';


来源:https://stackoverflow.com/questions/28496065/epoch-to-timeformat-yyyy-mm-dd-hhmiss-while-redshift-copy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!