nosql—数据被插入到与cassandra中不同的列中

pvcm50d1  于 2021-06-13  发布在  Cassandra
关注(0)|答案(0)|浏览(189)
def insert_data(self):
    insert_sql = self.session.prepare("INSERT INTO customer 
       (ID ,Name,Gender , Age , Region ,Job, Balance ) 
       VALUES ( ?, ?, ?, ?, ?, ?,?)")
    batch = BatchStatement()
    batch.add(insert_sql, ('100000051', 'Abhishek', 'Male','20', 'India','Engineer','199992.9'))
    #Add any new value if you want to insert in cassandra table
    self.session.execute(batch) 
    self.log.info('Batch Insert Completed')

但数据被插入了错误的列:

id        | region           | age   | balance   | gender | job          | name
    -----------+------------------+-------+-----------+--------+--------------+-----------
100000025 |          England |    38 |  20505.32 | Female | White Collar |  Jennifer
200000017 |         Scotland |    31 |  10356.31 | Female |        Other |     Grace
300000015 |            Wales |    36 |   2846.03 | Female |        Other | Madeleine
200000029 |         Scotland |    50 |   20516.1 |   Male |  Blue Collar |     Lucas
100000019 |          England |    40 |  65534.69 |   Male |  Blue Collar |   William
100000050 |         Engineer | India |      20   |   Male |     199992.9 |  Abhishek

上面的代码有什么问题?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题