Git Product home page Git Product logo

p5-dbix-class-batchupdate's People

Contributors

jplindstrom avatar

Watchers

 avatar  avatar

p5-dbix-class-batchupdate's Issues

Dangerous assumption of immutable PK

Sorry that I didn't notice this the first time around. This is not... ideal. What you want to do is to fall back to the original one-by-one update() logic when any part of the PK (which could be multicolumn) is dirty. Perhaps with a warning (yada-yada BatchUpdate ineffective).

Doing anything else is likely to result in bugs that will be extraordinarily hard to diagnose.

ORA-1795: maximum number of expressions in a list is 1000

Hi Johan,

just testet the module and failed when trying to update a single attribute for 10.000 rows with a single batch_update() - call. The underlying database is an Oracle Enterprise DB v11. Getting a

ORA-01795

Seems as the update is made with an IN list containing the primary keys. IN lists are limited to 1000 elements for Oracle databases.

Here's the stack

    DBIx::Class::Schema::throw_exception(ADD::Schema=HASH(0x563ef5a33988), "DBI Exception: DBD::Oracle::st execute failed: ORA-01795: max"...) called at /home/damenc/workspace/add.dev/lib/site_perl/DBIx/Class/Storage.pm line 113
    DBIx::Class::Storage::throw_exception(DBIx::Class::Storage::DBI::Oracle::Generic=HASH(0x563ef5a44880), "DBI Exception: DBD::Oracle::st execute failed: ORA-01795: max"...) called at /home/damenc/workspace/add.dev/lib/site_perl/DBIx/Class/Storage/DBI.pm line 1501
    DBIx::Class::Storage::DBI::__ANON__[/home/damenc/workspace/add.dev/lib/site_perl/DBIx/Class/Storage/DBI.pm:1508]("DBD::Oracle::st execute failed: ORA-01795: maximum number of "..., DBI::st=HASH(0x563ef7390068), undef) called at /home/damenc/workspace/add.dev/lib/site_perl/DBIx/Class/Storage/DBI.pm line 1836
    DBIx::Class::Storage::DBI::_dbh_execute(DBIx::Class::Storage::DBI::Oracle::Generic=HASH(0x563ef5a44880), DBI::db=HASH(0x563ef5eb4268), "UPDATE auftrag SET abruf_tag = ? WHERE ( id_auftrag IN ( ?, ?"..., ARRAY(0x563ef6f158a8), ARRAY(0x563ef66562b8)) called at /home/damenc/workspace/add.dev/lib/site_perl/DBIx/Class/Storage/DBI/Oracle/Generic.pm line 297
    DBIx::Class::Storage::DBI::Oracle::Generic::_dbh_execute(DBIx::Class::Storage::DBI::Oracle::Generic=HASH(0x563ef5a44880), DBI::db=HASH(0x563ef5eb4268), "UPDATE auftrag SET abruf_tag = ? WHERE ( id_auftrag IN ( ?, ?"..., ARRAY(0x563ef6f158a8), ARRAY(0x563ef66562b8)) called at /home/damenc/workspace/add.dev/lib/site_perl/DBIx/Class/Storage/DBI.pm line 840
    DBIx::Class::Storage::DBI::dbh_do(DBIx::Class::Storage::DBI::Oracle::Generic=HASH(0x563ef5a44880), "_dbh_execute", "UPDATE auftrag SET abruf_tag = ? WHERE ( id_auftrag IN ( ?, ?"..., ARRAY(0x563ef6f158a8), ARRAY(0x563ef66562b8)) called at /home/damenc/workspace/add.dev/lib/site_perl/DBIx/Class/Storage/DBI.pm line 1817
    DBIx::Class::Storage::DBI::_execute(DBIx::Class::Storage::DBI::Oracle::Generic=HASH(0x563ef5a44880), "update", DBIx::Class::ResultSource::Table=HASH(0x563ef5a89848), HASH(0x563ef6dbfe10), REF(0x563ef6fd4838)) called at /home/damenc/workspace/add.dev/lib/site_perl/DBIx/Class/Storage/DBI.pm line 2398
    DBIx::Class::Storage::DBI::update(DBIx::Class::Storage::DBI::Oracle::Generic=HASH(0x563ef5a44880), DBIx::Class::ResultSource::Table=HASH(0x563ef5a89848), HASH(0x563ef6dbfe10), REF(0x563ef6fd4838)) called at /home/damenc/workspace/add.dev/lib/site_perl/DBIx/Class/ResultSet.pm line 2013
    DBIx::Class::ResultSet::_rs_update_delete(ADD::Schema::ResultSet::Auftrag=HASH(0x563ef6f07ee0), "update", HASH(0x563ef6dbfe10)) called at /home/damenc/workspace/add.dev/lib/site_perl/DBIx/Class/ResultSet.pm line 2062
    DBIx::Class::ResultSet::update(ADD::Schema::ResultSet::Auftrag=HASH(0x563ef6f07ee0), HASH(0x563ef6dbfe10)) called at /home/damenc/workspace/add.dev/lib/site_perl/DBIx/Class/BatchUpdate/Batch.pm line 16
    DBIx::Class::BatchUpdate::Batch::update(DBIx::Class::BatchUpdate::Batch=HASH(0x563ef6e4b178)) called at /home/damenc/workspace/add.dev/lib/site_perl/DBIx/Class/BatchUpdate/Update.pm line 92
    DBIx::Class::BatchUpdate::Update::update(DBIx::Class::BatchUpdate::Update=HASH(0x563ef6dbfb40)) called at /home/damenc/workspace/add.dev/test.pl line 24

Hoped that module would handle exactly that as currently I'm solving this by updating rows in sliced portions via primary key.

Experimental push on scalar is now forbidden

Test suite fails with perl 5.23.x:

Experimental push on scalar is now forbidden at t/dbix-class-batchupdate-update.t line 44, near "$args)"
Execution of t/dbix-class-batchupdate-update.t aborted due to compilation errors.
t/dbix-class-batchupdate-update.t .. 
Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run 

support for non-id field as primary key column name

Hi @jplindstrom ,

Thanks for your efforts in writing this module for batch update.
I would like to use this module for batch updating via DBIx-Class in my project. But it seems at present its accepting only id as primary key column name as documented.
Usually we can have primary key column name different from id, i prepared patch to use non-id as primary key column name.
I verified tests and non-id field test scenario 'pkid' is already covered in your test script and its passed with this patch.
Could you please review this git patch(i zipped git patch file as github not allowing me to attach .patch files) and merge to main repo if possible.

Thanks
Mohan

0001-Allow-non-id-field-name-as-primary-key.zip

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.