def test_insert_rows_happy_path(pgtestdb_conn, pgtestdb_test_tables, pgtestdb_insert_sql, test_table_data, commit_chunks): # Parameterized to ensure success with and without commit_chunks # Arrange insert_sql = pgtestdb_insert_sql.replace('src', 'dest') # Act executemany(insert_sql, pgtestdb_conn, test_table_data, commit_chunks=commit_chunks) # Assert sql = "SELECT * FROM dest" result = get_rows(sql, pgtestdb_conn) assert result == test_table_data
from etlhelper import executemany, DbParams, get_rows sqlite_first = DbParams(dbtype='SQLITE', filename='C:\\Users\\vipin.soni\\db1.db') sqlite_second = DbParams(dbtype='SQLITE', filename='C:\\Users\\vipin.soni\\db2.db') rows = [(5, 'vinay'), (6, 'rohit')] insert_sql = "INSERT INTO company (id, name) VALUES (?, ?)" select_sql = "SELECT * from company" with sqlite_first.connect() as conn: executemany(insert_sql, conn, rows) xx = get_rows(select_sql, conn) print(xx)