NumberRows = int(sys.argv[2]) FKreptFactor = int(sys.argv[3]) NumberRows = int(NumberRows) if NumberRows >= 1000: NumberRowsStr = str(int(NumberRows / 1000)) + "K" else: NumberRowsStr = str(NumberRows) print("Number of Rows: {}, FK Rep Factor: {}".format(NumberRows, FKreptFactor)) # ============================================== # Insert Section # ============================================== #Initialize data reporting Table.SetVerifyConstraints(True) Table.UseFKTables(True) # ***Build the tables*** BuildTables(database) # ***Insert priming data, collect Insert times*** insertStartTime = time.time( ) #insertStartTime/EndTime only use to give an overall time for the insert loop insertAll_times = InsertData(FKreptFactor) insertEndTime = time.time() # ### Calculate Time Statistics (Checking constraints during Insert) logCSVdata(insertAll_times, "Ins", Table.GetVerifyConstraints()) noConstraintTimesAll = [] if _DB_mode == "AS":
user="******", database="test_DB_SQL" -Args for AWS SQL database host="18.191.176.248", user="******", passwd="DrBajaj2*", database="test_DB_SQL" ''' sqlCursor = client.cursor(buffered=True) Table.SetTableClient(client, sqlCursor) print("Benchmarking with MySQL, Schema 1") # ============================================== # Start of Main Program Loop # ============================================== Table.SetVerifyConstraints(True) Table.UseFKTables(True) # Test 1: Insert a row into a table with an already existing PK BuildSchema1(database) TableA = Table._registry[0] TableB = Table._registry[1] TableA.Insert([1, "datadata"]) TableA.Insert([2, "datadata"]) # This should work print(">>> Test 1: Expect an Insert Failed error, non-unique PK value") TableA.Insert([1, "datadata"]) # This should fail # Should now have Table 1A with 2 rows, PK = 1 and PK = 2. Table 1B is still empty # Test 2: Insert a row into a table where the referenced FK value does not exist TableB.Insert([1, 1, "datadata"])