I'm working with raw data that has a comma as the decimal separator rather than fullstop (3,99 instead of 3.99). Is there a way to convert this directly in redshift copy command rather than having to upload then change afterwards?
标签:
amazon-redshift
相关问题
- How to generate 12 digit unique number in redshift
- How to handle quoted values in AWS Redshift unload
- psycopg2.ProgrammingError: syntax error at or near
- how can aws glue job upload several tables in reds
- when unloading a table from amazon redshift to s3,
相关文章
- in redshift postgresql can I skip columns with the
- Redshift table update with join
- How to get a list of UDFs in Redshift?
- Sql Alchemy cannot run inside a transaction block
- Alternatives for Athena to query the data on S3
- Copy a datetime with the format rfc822 into redshi
- How should records be formatted for AWS Kinesis Fi
- Return elements of Redshift JSON array on separate
There are two issues to consider:
The default delimiter in the Amazon Redshift
COPY
command is a pipe character ( | ), unless the CSV option is used, in which case the default delimiter is a comma ( , ).Thus, if your file is delimited by a non-comma character (eg a pip "|" symbol), then the comma in a number will not split across fields.
As to converting the comma into a decimal, this is not possible. You will need to load the field as a string, and then run an UPDATE command to copy the string into a numeric field (with a bit of character replacement too).
Alternatively, try to pre-process the file before loading into Redshift (eg through
sed
), so it is clean before loading into Redshift.