如何创建没有双引号的没有空格的Cassandra列?
我正在创建Cassandra表,其中一些列可以具有白色空间,例如“获得%的标记”,
我可以像下面的表格一样创建表
CREATE TABLE test1 (Time text ,"Marks Obtained in %" text ,PRIMARY KEY (Time));
,现在我的所有检索都可以提供该问题,我必须在double Quotes中提供列名称,不起作用。
例如:
select "Marks Obtained in %" from test1
列名称本身变为“以%获得的标记”,并以双引号,而不是以%>获得的标记。没有双引号。
由于表由Python程序创建,因此我需要在创建所有列时保持统一性。
Cassandra有什么办法可以用白色空间制作列名称,我在SQL中看到了下面的东西
CREATE TABLE IDE_Dump
(
Name VARCHAR(255),
[Head Name] VARCHAR(255),
[Parent Account] VARCHAR(255)
);
I am creating cassandra table, where some column can have white spaces like "Marks Obtained in %"
I can create table like below which works
CREATE TABLE test1 (Time text ,"Marks Obtained in %" text ,PRIMARY KEY (Time));
The issue is now for all my retrieve query, I have to supply column name inside double quotes else it will not work.
ex:
select "Marks Obtained in %" from test1
The column name itself becomes "Marks Obtained in %" with double quotes and not <Marks Obtained in %> without double quotes.
Since table creation is via python program, I need to maintain uniformity, while creating all the columns.
Is there any way in cassandra to make column names with white spaces, I saw in SQL something like below
CREATE TABLE IDE_Dump
(
Name VARCHAR(255),
[Head Name] VARCHAR(255),
[Parent Account] VARCHAR(255)
);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不幸的是,不可能在不将其包装在引号中的情况下指定带有空格的列名。
作为解决方法,将空格与下划线(
_
)之类的交换,例如column_name
。干杯!Unfortunately, it isn't possible to do specify a column name with spaces without enclosing them in quotes.
As a workaround, swap the spaces with underscores (
_
) likecolumn_name
. Cheers!另一种替代方法是使用 noflowl noreferrer“ /a>在选择期间,使用
从keyspace_name.table_name中选择scods_in_perct作为“以%获得的标记”,其中...;
实现此目的。Another alternative approach is to use a column with the supported character limits and during the selection, use
SELECT marks_in_perct AS "Marks Obtained in %" from keyspace_name.table_name WHERE ...;
to achieve this.