小编Cho*_*ean的帖子

使用Enum项目作为列表索引

我有这段代码:

class FileType(Enum):
    BASIC = 0
    BASIC_CORRUPTED = 1
    BASIC_SHITTY_END = 2
    MIMIKATZ = 3
    HASHCAT = 4

    def __eq__(self, v):
        """
        Override == in order to make `FileType.BASIC == 0` equals to True, etc.
        """
        return self.value == v if isinstance(v, int) else self.value == v.value
Run Code Online (Sandbox Code Playgroud)

我想知道如果要执行以下操作应该添加什么:random_array[FileType.MIMIKATZ]。目前,Python3告诉我TypeError: list indices must be integers or slices, not FileType

python enums python-3.x

3
推荐指数
1
解决办法
96
查看次数

ClickHouse - 每个查询插入一百多个条目

我不知道如何增加每个查询的最大条目数。我想每个查询插入一千个条目,默认值为 100。

根据doc,该参数max_partitions_per_insert_block定义了同时输入的限制。

我尝试从 ClickHouse 客户端修改它,但插入仍然失败:

$ clickhouse-client
my-virtual-machine :) set max_partitions_per_insert_block=1000

*SET* max_partitions_per_insert_block = 1000

Ok.

0 rows in set. Elapsed: 0.001 sec. 
Run Code Online (Sandbox Code Playgroud)

而且,这不是文件max_partitions_per_insert_block中的字段/etc/clickhouse-server/config.xml

修改后max_partitions_per_insert_block,我尝试插入数据,但遇到了此错误:

infi.clickhouse_orm.database.ServerError: Code: 252, e.displayText() = DB::Exception: Too many partitions for single INSERT block (more than 100). The limit is controlled by 'max_partitions_per_insert_block' setting. Large number of partitions is a common misconception. It will lead to severe negative performance impact, including slow server startup, slow …
Run Code Online (Sandbox Code Playgroud)

clickhouse

2
推荐指数
1
解决办法
8559
查看次数

标签 统计

clickhouse ×1

enums ×1

python ×1

python-3.x ×1