开始使用免费开始使用

Load data from a list into the Table

Using the multiple insert pattern, in this exercise, you will load the data from values_list into the table.

本练习是课程的一部分

Introduction to Databases in Python

查看课程

练习说明

  • Import insert from sqlalchemy.
  • Build an insert statement for the census table.
  • Execute the statement stmt along with values_list. You will need to pass them both as arguments to connection.execute().
  • Print the rowcount attribute of results.

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Import insert


# Build insert statement: stmt


# Use values_list to insert data: results


# Print rowcount
print(____)
编辑并运行代码