Franco
Franco

Reputation: 87

Inserto into table select * from - web2py DAL

Ciao,

I need to execute a query like

insert into TableA Select * form TableB 

where tableA and TableB share the same structure. How can I accomplish this result using the web2py DAL (in order to abstract the query from the database specific syntax)?

I add also that TableB has about million rows and 20 columns.

Thank you

Upvotes: 0

Views: 162

Answers (1)

Anthony
Anthony

Reputation: 25536

The web2py DAL does not have an API for generating such a query, so you will have to use raw SQL. You can still use the DAL connection by using its .executesql method:

db.executesql('insert into TableA select * from TableB')

Upvotes: 1

Related Questions