Trouble using hubDB tables in modules between dev and production

We use the following:

{% set hubDbPageId = 2617347 %}

{% set rwItem = hubdb_table_rows(hubDbPageId, 'hs_path='~countryFilter)|first %}

If I fetch that code from production and want to upload it to my test sandbox. I receive an error the table does not exist. I have the same table but with different ID in my sandbox.

How can I make my module portable, e.g. reference hubDB tables by name or so?

Hi @OBojahr,

is it a (custom) module you’re using or is this implemented in some sort of template directly?

If custom module you could add a HubDB function to the module and write the code like this

{% set hubDbPageId = module.hubdb_selector %}

{% set rwItem = hubdb_table_rows(hubDbPageId, 'hs_path='~countryFilter)|first %}

this will give you the ability to easily select the HubDB in the page builder (or design-tools)

if it’s implemented in a template there’s basically no solution since the HubDB ID can’t be changed and is a randomly generated number. You’ll need to change the number manually in the file

best,

Anton