-
-
Notifications
You must be signed in to change notification settings - Fork 48
Milestone
Description
What happened?
When opening an excel file with the from_excel() function, the schema definitions cannot be read without the filename contianing the file extension.
How to reproduce?
<?php
use PHPUnit\Framework\TestCase;
use function Flow\ETL\Adapter\Excel\DSL\from_excel;
use function Flow\ETL\DSL\data_frame;
class FlowTest extends TestCase
{
/**
* Successful test
* @return void
*/
public function test_existing_file_extension()
{
#file with file extension
$filepath = __DIR__ . '/ExcelExample.xlsx';
$dataFrame = data_frame()->read(from_excel($filepath));
$definitions = $dataFrame->schema()->definitions();
self::assertNotEmpty($definitions);
}
/**
* Failing test with Flow\ETL\Exception\InvalidArgumentException
* @return void
*/
public function test_missing_file_extension()
{
# same file without file extension
$filepath = __DIR__ . '/ExcelExample';
$dataFrame = data_frame()->read(from_excel($filepath));
# Flow\ETL\Exception\InvalidArgumentException: Failed to open file: Unsupported file extension: n/a
# \vendor\flow - php\etl - adapter - excel\src\Flow\ETL\Adapter\Excel\ExcelExtractor . php:188
# \vendor\flow - php\etl - adapter - excel\src\Flow\ETL\Adapter\Excel\ExcelExtractor . php:58
# \vendor\flow - php\etl\src\Flow\ETL\Pipeline\SynchronousPipeline . php:47
# \vendor\flow - php\etl\src\Flow\ETL\DataFrame . php:855
$definitions = $dataFrame->schema()->definitions();
self::assertNotEmpty($definitions);
}
}Data required to reproduce bug locally
Version
"flow-php/etl": "1.x-dev",
"flow-php/etl-adapter-excel": "1.x-dev"
Relevant error output
Caused by
Flow\ETL\Exception\InvalidArgumentException: Unsupported file extension: n/aMetadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done