You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Benjamin Lerer (Jira)" <ji...@apache.org> on 2021/07/06 15:23:00 UTC

[jira] [Comment Edited] (CASSANDRA-16787) Copy from csv file with duration type fields fails to import

    [ https://issues.apache.org/jira/browse/CASSANDRA-16787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17375799#comment-17375799 ] 

Benjamin Lerer edited comment on CASSANDRA-16787 at 7/6/21, 3:22 PM:
---------------------------------------------------------------------

The problem seems to be that we do not have a converter for {{duration}} within the {{copyutil.py}} script.


was (Author: blerer):
The problem seems to be that we do not have a converter for duration within the copyutil.py script.

> Copy from csv file with duration type fields fails to import
> ------------------------------------------------------------
>
>                 Key: CASSANDRA-16787
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-16787
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Tool/cqlsh
>            Reporter: Brijesh Dungarakoti
>            Assignee: Benjamin Lerer
>            Priority: Normal
>         Attachments: error_cassandra_copy_from_1.JPG, error_cassandra_copy_from_2.JPG
>
>
> Getting error:
> _cqlsh> COPY users.user_credentials_by_email FROM '/home/ubuntu/users.csv' WITH HEADER = FALSE AND NULL='null';_
> _Using 3 child processes_
> _Starting copy of users.user_credentials_by_email with columns [email, la_duration]._
> _Failed to make batch statement: Received an argument of invalid type for column "la_duration". Expected: <class 'cassandra.cqltypes.DurationType'>, Got: <type 'str'>; (DurationType arguments must be a Duration.)_
> _Failed to import 1 rows: TypeError - Received an argument of invalid type for column "la_duration". Expected: <class 'cassandra.cqltypes.DurationType'>, Got: <type 'str'>; (DurationType arguments must be a Duration.), given up without retries_
> _Failed to process 1 rows; failed rows written to import_users_user_credentials_by_email.err_
> _Processed: 1 rows; Rate: 2 rows/s; Avg. rate: 2 rows/s_
> _0 rows imported from 1 files in 0.431 seconds (0 skipped)._
> *To Reproduce:*
> CREATE KEYSPACE users WITH replication = \{'class': 'NetworkTopologyStrategy', 'datacenter1': '1'} AND durable_writes = true;
> CREATE TABLE users.user_credentials_by_email (
> email text,
> la_duration duration,
> PRIMARY KEY(email)
> );
> create users.csv file with: 
> LA@LA.com,8m26s482ms
> Run:
> COPY users.user_credentials_by_email FROM '/home/automaton/users.csv' WITH HEADER = FALSE AND NULL='null';



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org