Import - Generic SQL Datasource

From Magmi Wiki
Jump to: navigation, search

Generic SQL Datasource

This Datasource enable to use external SQL databases to be used as import data feed.

How to use it

For the plugin to work, it needs some query files to be located at the following location : <magmi_install_dir>/plugins/base/datasources/genericsql/requests

The plugin lets you select the source database type:

Mysql or Other

If Mysql, plugin will present different fields for filling connection info

If Other , plugin will ask for a PDO dsn entry . see here for more information

  • the files MUST have .sql (lowercase) extension in order to be listed for selection
  • the file MUST contain a SINGLE SELECT request returning all the data
  • the SELECT request might be as complicated as you want (containing subselects , multiple joins ....)

An optional file with same name than the .sql one and with extension .sql.count may be added to provide "fast" count if possible.

This optional file may become necessary if the syntax used by magmi for counting records via subselecting the main request is not accepted by the target database

What columns to put in the SELECT

Your SELECT should ideally return the same columns as the one you would have put in a magmi csv.

However, since magmi can map column names, it's not an obligation

Moreover, as for any other datasource, magmi can provide default values using the default value mapper plugin if your SELECT returns no "magento" system columns as store or websites.


Back to Product Import Related Plugins