Documentation: error in SQL Expression Language tutorial(?)

Issue #3648 closed
Joakim Nybäck created an issue

Hi, I followed the SQLAlchemy SQL Expression Language tutorial from the beginning. I added the code as I went along, including the code for creating the two tables in the section "Define and Create Tables" (section 3.1.3 in the PDF version; the PDF is for Release 1.1.0b1 and dated 13-FEB-2016). When I execute the code an exception is thrown:

"UnboundExecutionError: MetaData object is not bound to an Engine or Connection. Execution can not proceed without a database to execute against."

The code listed in the tutorial includes this line:

metadata = MetaData()

If I change that line to:

metadata = MetaData(bind=engine)

then the code works fine.

Comments (2)

  1. Joakim Nybäck reporter

    Crap, I missed the argument to the create_all() function. I had

    metadata.create_all()
    

    instead of

    metadata.create_all(engine)
    

    Apologies.

  2. Log in to comment