Giter Site home page Giter Site logo

Comments (3)

hjwp avatar hjwp commented on May 27, 2024 3

it's definitely a bit of a head-scratcher. session.execute returns the results of your SELECT query, which the set of rows that match the query. each row is made up of columns. so the return type is a list of tuples. in this case i know it's exactly one row containing a tuple with exactly one item (the id of the row in the order_lines table), which is why the tuple unpacking works.

i could add a footnote maybe? i didn't want the focus of the book to be teaching people how to use sqlalchemy, but i don't want code listings to be so weird as to be obscure and cause people to wonder how on earth they work!

from code.

adrienbrunet avatar adrienbrunet commented on May 27, 2024 3

I had to read it twice and give it a few seconds of thoughts. A footnote should help !

Also for me, it would be a bit less confusing with

[(orderlineid, )] = ...

from code.

hjwp avatar hjwp commented on May 27, 2024

fixed here, thanks for the feedback everyone. cosmicpython/book@609d5a2

from code.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.