Sqlalchemy Core, insert statement returning * (all columns)

Nick Humrich

I am using sqlalchemy core (query builder) to do an insert using a table definition. For example:

table.insert().values(a,b,c)

and I can make it return specific columns:

table.insert().values(a,b,c).returning(table.c.id, table.c.name)

but I am using postgres which has a RETURNING * syntax, which returns all the columns in the row. Is there a way to do that with sqlalchemy core?

user3437231
query = table.insert().values(a,b,c).returning(literal_column('*'))

And you can access it like

for col in execute(query, stmt):
   print(col)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Insert and update with core SQLAlchemy

From Dev

INSERT INTO ... RETURNING multiple columns (PostgreSQL)

From Dev

SQL statement not returning all values

From Dev

What is the difference between SELECT * and returning all columns by specfying each in the Select statement / Union query returns Duplicates

From Dev

SQLAlchemy inheritance filter on all columns

From Dev

Preparing insert statement for multiple columns

From Dev

Preparing insert statement for multiple columns

From Dev

psql insert statement returning baffling error

From Dev

INSERT ALL statement in Oracle failing to insert

From Dev

PostgreSQL multi INSERT...RETURNING with multiple columns

From Dev

PostgreSQL multi INSERT...RETURNING with multiple columns

From Dev

bulk insert list values with SQLAlchemy Core

From Dev

Insert if not exist - lookup by all columns

From Dev

Insert if not exist - lookup by all columns

From Dev

Prepared SQL LIKE statement not returning all results

From Dev

If statement for ViewHolder is returning false all everytime

From Dev

SQLAlchemy join - return all columns of one table

From Dev

How to update all object columns in SqlAlchemy?

From Dev

Fewer Columns In INSERT Statement Than In Values Clause

From Dev

There are fewer columns in the INSERT statement than values specified

From Dev

Joining with set-returning function (SRF) and access columns in SQLAlchemy

From Dev

Joining with set-returning function (SRF) and access columns in SQLAlchemy

From Java

Returning a dataframe with all columns except for 'name'

From Dev

Pandas 'describe' is not returning summary of all columns

From Dev

How to insert all rows in a single statement

From Dev

Return (self) generated value from insert statement (no id, no returning)

From Dev

INSERT ...RETURNING .. comes up empty when BEFORE trigger cancels statement

From Dev

Perform replace on all columns of a select statement

From Dev

Insert values and default on all others columns

Related Related

  1. 1

    Insert and update with core SQLAlchemy

  2. 2

    INSERT INTO ... RETURNING multiple columns (PostgreSQL)

  3. 3

    SQL statement not returning all values

  4. 4

    What is the difference between SELECT * and returning all columns by specfying each in the Select statement / Union query returns Duplicates

  5. 5

    SQLAlchemy inheritance filter on all columns

  6. 6

    Preparing insert statement for multiple columns

  7. 7

    Preparing insert statement for multiple columns

  8. 8

    psql insert statement returning baffling error

  9. 9

    INSERT ALL statement in Oracle failing to insert

  10. 10

    PostgreSQL multi INSERT...RETURNING with multiple columns

  11. 11

    PostgreSQL multi INSERT...RETURNING with multiple columns

  12. 12

    bulk insert list values with SQLAlchemy Core

  13. 13

    Insert if not exist - lookup by all columns

  14. 14

    Insert if not exist - lookup by all columns

  15. 15

    Prepared SQL LIKE statement not returning all results

  16. 16

    If statement for ViewHolder is returning false all everytime

  17. 17

    SQLAlchemy join - return all columns of one table

  18. 18

    How to update all object columns in SqlAlchemy?

  19. 19

    Fewer Columns In INSERT Statement Than In Values Clause

  20. 20

    There are fewer columns in the INSERT statement than values specified

  21. 21

    Joining with set-returning function (SRF) and access columns in SQLAlchemy

  22. 22

    Joining with set-returning function (SRF) and access columns in SQLAlchemy

  23. 23

    Returning a dataframe with all columns except for 'name'

  24. 24

    Pandas 'describe' is not returning summary of all columns

  25. 25

    How to insert all rows in a single statement

  26. 26

    Return (self) generated value from insert statement (no id, no returning)

  27. 27

    INSERT ...RETURNING .. comes up empty when BEFORE trigger cancels statement

  28. 28

    Perform replace on all columns of a select statement

  29. 29

    Insert values and default on all others columns

HotTag

Archive