首页 \ 问答 \ 插入到mysql数据库时间戳(insert into a mysql database timestamp)

插入到mysql数据库时间戳(insert into a mysql database timestamp)

我在我的python脚本中有一部分需要在下面的mysql数据库示例中将一些数据插入到表中:

insert_data = "INSERT into test (test_date,test1,test2) values (%s,%s,%s)"
cur.execute(insert_data,(test_date,test1,test2))
db.commit()
db.close()

我有几个问题,这个语法有什么不正确,以及如何将VALUES更改为时间戳而不是%s作为字符串? 请注意,数据库中的列名称与我脚本中的变量中存储的数据相同。

谢谢


I have a part in my python script that I need to insert some data into a table on a mysql database example below:

insert_data = "INSERT into test (test_date,test1,test2) values (%s,%s,%s)"
cur.execute(insert_data,(test_date,test1,test2))
db.commit()
db.close()

I have a couple of questions what is incorrect with this syntax and how is possible to change the VALUES to timestamp instead of %s for string? Note the column names in the database are the same as the data stored in the variables in my script.

THanks


原文:https://stackoverflow.com/questions/34046634
更新时间:2022-03-15 15:03

最满意答案

您需要启用压缩,min会自动添加到输出文件。

在您的构建定义中,您需要以下内容:

LessKeys.compress in Assets := true

You need to enable compression and the min will be added automatically to the output file.

In your build definition, you need the following:

LessKeys.compress in Assets := true

相关问答

更多
  • 正如CoffeeScript文档中所述 : 请注意,托管资源不会直接复制到应用程序的公用文件夹中,而是保存在target / scala-2.xx / resources_managed中的单独文件夹中。 您必须通过Assets控制器使用反向路由来访问它: