Ejemplo n.º 1
0
 protected function importTable($tableName, CsvFile $csvFile)
 {
     if ($csvFile->getEnclosure() && $csvFile->getEscapedBy()) {
         throw new Exception('Invalid CSV params. Either enclosure or escapedBy must be specified for Snowflake backend but not both.', Exception::INVALID_CSV_PARAMS, null);
     }
     try {
         $timerName = 'copyToStaging-' . $csvFile->getBasename();
         Debugger::timer($timerName);
         $results = $this->connection->fetchAll($this->generateCopyCommand($tableName, $csvFile));
         foreach ($results as $result) {
             $this->importedRowsCount += (int) $result['rows_loaded'];
         }
         $this->addTimer($timerName, Debugger::timer($timerName));
     } catch (\Exception $e) {
         throw new Exception('Load error: ' . $e->getMessage(), Exception::INVALID_SOURCE_DATA, $e);
     }
 }