[development] Drupal way to seed data for a module.

Matt Chapman matt at ninjitsuweb.com
Thu Jan 28 23:53:20 UTC 2010

If you're developing for Drupal 7, I thing the new Database API would
support a secondary database shipped with the module made up of magic
crayon drawings updated by smurfs. The new OOP DB API can do joins
across databases, so you're all set. You'll just have to write 10
lines of code for the driver.

Seriously, I'd probably just include the data in a CSV or SQL dump
file, and use some code inside hook_install() to import it.



On Thu, Jan 28, 2010 at 3:46 PM, Anth <malkouna at yahoo.com.au> wrote:
> Hi,
> I'm building a module that has a lot of supporting data (it's a custom
> shipping module that maps postcodes/zips to regions etc.) and know that I
> can create the table using hook_schema() and could use hook_install() to add
> rows of data to the schema, but I'm talking tens of thousands of rows, so
> wondering if there is a better method for doing this?
> Anthony.

More information about the development mailing list