typeorm: Insert too many sql variables

Issue type:

[ ] question [ ] bug report [x ] feature request [ ] documentation issue

Database system/driver:

[ x] cordova [ ] mongodb [ ] mssql [ ] mysql / mariadb [ ] oracle [ ] postgres [ ] sqlite [ ] sqljs [ ] react-native

TypeORM version:

[ ] latest [x ] @next [ ] 0.x.x (or put your version here)

I have many, many data to insert to my Database, and with save this is to slow i want it to be fast. With insert it is fast but i’ve got the sqlite error too many sql variables. Can you help me find a solution please ?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 15 (6 by maintainers)

Most upvoted comments

Imho, the library should handle it internally when it reaches the max limit.

~@nextbyn as already were answered, try to split your insert into chunks and run them one by one, check the comments above~ 🤷

It not possible to split on chunks if I save one entity which includes cascade collection. One CustomerOrder have many CustomerOrderPosition items, for example.

@OrmEntity()
class CustomerOrder {
    @Column()
    name: string
    
    @OneToMany(() => CustomerOrderPosition, position => position.order, { cascade: true })
    positions!: CustomerOrderPosition
}