Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to insert the data from XML file into database #54

Open
thangasujithas opened this issue Jun 1, 2021 · 5 comments
Open

Unable to insert the data from XML file into database #54

thangasujithas opened this issue Jun 1, 2021 · 5 comments

Comments

@thangasujithas
Copy link

Unable to insert the data from XML file into database
I am trying to use this module to extract and import data from XML files. But It is not inserting the data into the table and not showing any error too

Could you please tell whether it supports to insert data from XML to Database?

@ecourtial
Copy link
Contributor

Hi @thangasujithas
Did you try to use XDebug to see if it fails somewhere ? Did you enable errors displaying in PDO (disabled by default).
If you don't find anything, could you try our fork:
https://github.com/wizaplace/php-etl
Changelog here: https://github.com/wizaplace/php-etl/blob/master/changelog.MD :)

@thangasujithas
Copy link
Author

Could you please let me know whether it loads xml into database? please confirm this . because I have tried this https://github.com/wizaplace/php-etl as well.

@ecourtial
Copy link
Contributor

Difficult to help you without seeing your actual code :)

@thangasujithas
Copy link
Author

thangasujithas commented Jun 2, 2021

I am using the below code
`use Wizaplace\Etl\Etl;
use Wizaplace\Etl\Extractors\Xml;
use Wizaplace\Etl\Loaders\InsertUpdate;

$connexionFactory = new ConnectionFactory();
$manager = new Manager($connexionFactory);
$manager->addConnection($config);
$etl = new Etl();
$extractor = new Xml();
$loader = new InsertUpdate($manager);
$etl->extract($xmlExtractor, 'path to test.xml', [
'columns' => [

                        'name' => '/details/name',
                         'email' => '/details/email',
                    ]
                    ])
                
            ->load($loader, 'schema.mytable',['columns' => ['name' => 'name', 'email' => 'email']])
            ->run();

`

The below is the xml what I am using

[email protected]
`

@thangasujithas
Copy link
Author

It is now working fine with below code for another sample xml.

` $etl->extract($xmlExtractor, 'path to test.xml', [
'loop' => '/users/user',
'columns' => [

        'idPerson' => '/name',
        'country' => '/email',
      ]
    ])
   
   ->load($loader, 'etl.mytable', ['columns' => ['idPerson' => 'idPerson', 'country' => 'country']])
    ->run();`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants