gpt4 book ai didi

Django Cassandra 引擎 - 如何定义表名

转载 作者:行者123 更新时间:2023-12-04 08:20:15 27 4
gpt4 key购买 nike

我正在使用 Django Cassandra我已经定义了我的模型,我可以用它来命名一个表:

    class Meta:
db_table = "table_name"

但是,Cassandra 不会使用我的自定义名称创建表。我错过了什么?

最佳答案

https://datastax.github.io/python-driver/api/cassandra/cqlengine/models.html

table_name = None Optional. Sets the name of the CQL table for this model. If left blank, the table name will be the name of the model, with it’s module name as it’s prefix. Manually defined table names are not inherited.


class Meta:
__table_name__ = "table_name"

关于Django Cassandra 引擎 - 如何定义表名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55721827/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com