public void CanUploadTable()
        {
            var manifestObject = GetJsonFile <DatabaseJobManifest>(_inputRoot, "database.manifest.mysql.json");
            var sql            = GetJsonFile <TargetSql>(_inputRoot, "mysql.target.ateam.json");
            var data           = CreateTable();

            var target = new MySqlWriter();

            target.UploadTable(connectionString,
                               sql.SetupTempDml,
                               manifestObject.manifest.tables[0],
                               data,
                               new List <string> {
                sql.UpdateFromTempDml, sql.ClearTempDml
            });

            var reader = new MySqlReader();

            // Only get the records what you have Updated in database on the basis of Ids {Primary Keys}
            var result = reader.GetData(connectionString, $"select * from ex8_db1.ATeam where Id in ({string.Join(",",data.AsEnumerable().Select(r => r.Field<dynamic>("Id")))})");

            result.Tables.Should().NotBeEmpty();
            result.Tables[0].Rows.Should().NotBeEmpty();
            result.Tables[0].Should().Equals(data);
        }
Esempio n. 2
0
        public void UploadTable_LoadTest()
        {
            int recordCount = 500000;
            var data        = CreateTable("Post", recordCount);

            var manifestObject = GetJsonFile <DatabaseJobManifest>(_inputRoot, "database.manifest.mysql.json");
            var sql            = GetJsonFile <TargetSql>(_inputRoot, "mysql.target.ateam.json");

            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start(); // start timer

            var target = new MySqlWriter();

            target.UploadTable(connectionString,
                               sql.SetupTempDml,
                               manifestObject.manifest.tables[0],
                               data,
                               new List <string> {
                sql.UpdateFromTempDml, sql.ClearTempDml
            });

            stopwatch.Stop();                        // end timer
            var ElapsedDuration = stopwatch.Elapsed; // this is the elapsed duration for updating RecordsCount records in table database

            WriteLogCsvFile(new CsvLogger {
                TestDate = DateTime.Now, NoOfRecords = recordCount, TimeElapsed = ElapsedDuration
            });
        }