Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8920097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:10:52+00:00 2026-06-15T06:10:52+00:00

What are the differences between select and tablename.select() ? When I pass column name

  • 0

What are the differences between select and tablename.select()? When I pass column name to table.select like:

table.select(table.c.name)

the sql is like

select * from tablename where tablename.name

and when I pass a column to select (instance method):

select([table.c.name])

the sql is like

select name from tablename

I want the same result as select with table.select.

When I read the docs of select it’s the same so it’s the same method but why they have a different behavior?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:11:01+00:00Added an answer on June 15, 2026 at 6:11 am

    Presumably, with select() you mean sqlalchemy.sql.select().

    The select() function expressly takes a set of columns as it’s argument, and it’s result is a stand-alone Select instance. You can also pass in a FromClause object (like a table or an alias) and it’ll take the columns from that object. This is described in detail in the Selecting chapter of the core tutorial.

    The .select() method on a table on the other hand, takes a whereclause first argument, not a set of columns. In other words, whatever you pass to that method, form the WHERE filter for the select, not the columns you wanted to select. By passing in a column for the where clause, you are selecting all columns, but filtering on WHERE [columnname]. Not much of a filter, since there the expression doesn’t really restrict what rows will match.

    Proper use of the table.select() function is to pass in a selection filter, and the intention to select all columns:

    table.select(table.c.name != None)
    

    which would be compiled to:

    SELECT * FROM tablename WHERE tablename.name IS NOT NULL;
    

    (although SQLAlchemy, knowing what columns exist, expands * to an explicit list of all table column names).

    You should stick to the select() function to select only specific columns.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have query like this SELECT AVAILABILITY_DATE_TIME FROM APPT_PROVIDER_AVAILABILITY WHERE AVAILABILITY_DATE_TIME between @START_DATE AND
I would like to know what are the differences between using: SELECT email, COUNT(
What are the differences between the two queries? SELECT CountryMaster.Id FROM Districts INNER JOIN
What is the difference between SELECT data from table directly or from view? And
Whats the difference between SELECT DISTINCT field1 FROM table1 cd JOIN table2 ON cd.Company
a) A SQL statement is a single SQL command (for example, SELECT * FROM
I have been reading about the differences between Table Variables and Temp Tables and
I want to make a MySQL to get daily differential values from a table
I got confused on what are the differences between Linq-to-SQL and Entity Framework when
The title speaks for itself. The first query - SELECT * FROM table _t

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.