如何使用 cql 将数据从 .dat 文件加载到 table
how to load data from a .dat file into a table using cql
我尝试使用 cql 将 .dat 文件中的数据加载到我的 table 中。我只能在文档中找到要从 csv 文件读取的推荐,所以尝试了那种推荐,但都出现错误:
copy users (uid, gender, age, occu, zip) from ('/cassandra-input/users.dat') with delimiter = ':';
Improper copy command.
copy users (uid, gender, age, occu, zip) from ('/cassandra-input/users.dat' | stdin) with delimiter = ':';
Invalid syntax at line 1, char 77
copy users (uid, gender, age, occu, zip) from ('/cassandra-input/users.dat' | stdin) with delimiter = ':';
copy users from '/cassandra-input/users.dat' with delimiter = ':';
Not in any keyspace.
有没有人可以帮我弄清楚如何完成这项加载工作。
终于,我自己弄明白了。我不将文件移动到本地。它最初位于 hadoop 集群上。然后我使用
copy users (uid, gender, age, occu, zip) from 'users.dat' with delimiter = ':';
希望这对其他人有帮助。
我尝试使用 cql 将 .dat 文件中的数据加载到我的 table 中。我只能在文档中找到要从 csv 文件读取的推荐,所以尝试了那种推荐,但都出现错误:
copy users (uid, gender, age, occu, zip) from ('/cassandra-input/users.dat') with delimiter = ':';
Improper copy command.
copy users (uid, gender, age, occu, zip) from ('/cassandra-input/users.dat' | stdin) with delimiter = ':';
Invalid syntax at line 1, char 77
copy users (uid, gender, age, occu, zip) from ('/cassandra-input/users.dat' | stdin) with delimiter = ':';
copy users from '/cassandra-input/users.dat' with delimiter = ':';
Not in any keyspace.
有没有人可以帮我弄清楚如何完成这项加载工作。
终于,我自己弄明白了。我不将文件移动到本地。它最初位于 hadoop 集群上。然后我使用
copy users (uid, gender, age, occu, zip) from 'users.dat' with delimiter = ':';
希望这对其他人有帮助。