1

I'm trying to build a table with csvsql.

When I use command:

csvsql --db mysql://user:password@localhost:3306/database_name --table table_name  file.csv

I get the error:

(in table 'blabla', column 'xyz'): VARCHAR requires a length on dialect mysql

I've then tried to build a database schema and force it with --db-schema flag,

The db-schema format is:

CREATE TABLE table_name (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `x` varchar(29) DEFAULT NULL,
  `y` int(10) NOT NULL DEFAULT '0',
  `z` BOOL NOT NULL,
  PRIMARY KEY (`id`),
  KEY `indexed` (`indexed`)
);

but I still get the same error.

The complete command with db-schema is:

csvsql --db mysql://user:password@localhost:3306/database_name --table table_name --db-schema db_schema_filename csvfile.csv

I've read the manual for csvkit, but I don't get what I'm doing wrong.

This command should print the conversion result right?

Can someone please help?

Thank you.

1 Answers1

0

Well, found the solution in the github.

https://github.com/wireservice/csvkit/issues/758#issue-201924611

After update from github, no more errors and tables are created normaly.