I'm working on the module that retrieves stock data from yahoo, currently that data is stored in rows in a table. due to the large amount of data that will be retrieved (if i ever get it working the way i'd like), it would be very helpful for each stock symbol to have it's own db table.

Is hook_install() the only way to create a table from within drupal?

If i have a variable $stock (the stock's ticker symbol), is there any way for the module to create a table using the $stock variable?

The desired result is that if $stock is assigned the value GOOG by a user using the stock lookup form, the module creates a table named GOOG.

Can this be done?

Comments

crick’s picture

nevermind, i figured it out.

nevets’s picture

It would be best if your table name reflected both your module name and $stock to avoid name collisions. So if your module was called 'example' and $stock was 'GOOG' the table name might be 'example_GOOG'

crick’s picture

Yeah that's how I set it up. If GOOG is looked up, a new table is created 'stockapi_GOOG'.