你好,
我目前在嚐試databricks-jdbc: 2.6.29並試圖執行批量插入查詢
什麼是推薦的最優批量大小為執行批量插入查詢磚嗎?
目前看來,值由行即使批量插入的行插入。
有推薦的方式來執行多行插入嗎?
請注意:使用JDBC commons-dbutils作為包裝器。
公共靜態孔隙insertRecordsBatchDbUtils(){字符串dbUrl = " jdbc:磚:/ / # # # # # # # # # # # # # # # # # # # # #”;數據源d =新數據源();d.setURL (dbUrl);d.setUserID(“令牌”);d.setPassword (“# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #”);QueryRunner QueryRunner = new QueryRunner ();試(連接con = d.getConnection()){字符串sql = "插入事件。segment_debuggability_test值(?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; int[] result = queryRunner.batch(con, sql, new Object[][]{ {"130", "bolt_regular_customer", "advertiser public", "DELETE", "3455642", "bolt", "org3","org","file_34","azure_blob_path_1","M-Particle","success","10/10/2022 20:00","compliance success","1"}, {"132", "swiggy_customer", "advertiser private", "ADD", "3455634", "swiggy", "org5","org","file_209","s3_path_134","Private Segment","success","25/10/2022 20:00","compliance success","1"}, {"122", "zomato_customer", "advertiser public", "ADD", "34556445", "zomato", "org45","org","file_090","s3_path_161","S3 Segment Upload","failure","13/10/2022 20:00","compliance failure : advertiser-non-compliant","1"}}); System.out.println("Inserted Records :: " + result.length); } catch (SQLException e) { e.printStackTrace(); } }