代码拉取完成,页面将自动刷新
crown is a simple and small ORM forTDengine(TSDB)
Most users will want to simply install the latest version, hosted on PyPI:
pip install crown
The project is hosted at https://github.com/machine-w/crown and can be installed using git:
git clone https://github.com/machine-w/crown.git
cd crowm
python setup.py install
Model Definition:
from crown import *
import datetime
DATABASENAME = 'taos_test'
HOST = 'localhost'
PORT = 6041
db = TdEngineDatabase(DATABASENAME,host=HOST)
# db = TdEngineDatabase(DATABASENAME,host=HOST,port=PORT,user='yourusername',passwd='yourpassword')
class Meter1(Model):
cur = FloatField(db_column='c1')
curInt = IntegerField(db_column='c2')
curDouble = DoubleField(db_column='c3')
desc = BinaryField(db_column='des')
class Meta:
database = db
db_table = 'meter1'
class AllField(Model):
name_float = FloatField(column_name='n_float')
name_double = DoubleField()
name_bigint = BigIntegerField()
name_int = IntegerField()
name_smallint = SmallIntegerField()
name_tinyint = TinyIntegerField()
name_nchar = NCharField(max_length=59)
name_binary = BinaryField(max_length=3)
name_ = BooleanField()
dd = PrimaryKeyField()
birthday = DateTimeField()
class Meta:
database = db
db_table = 'all_field'
creat database and delete database:
db.create_database(safe=True)
# db.create_database(safe=True,keep= 100,comp=0,replica=1,quorum=2,blocks=115)
db.drop_database(safe=True)
alter database:
db.alter_database(keep= 120,comp=1,replica=1,quorum=1,blocks=156)
create drop and exist table:
Meter1.create_table(safe=True)
# db.create_table(Meter1,safe=True)
Meter1.drop_table(safe=True)
# db.drop_table(Meter1,safe=True)
Meter1.table_exists()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。