Specify different account for HubDB table

Background info:

I’m using a developer account to build my site using the continous integration method outlined here: Set up continuous integration with a GitHub repository using GitHub Actions - HubSpot docs

In other words, I’m using version control with a staging area for my site.

As a result I have 2 accounts, we’ll call them “production” and “developer” accounts. I use the developer account to build out site templates and test them before merging them to production.

The problem:

Unfortunately, I’ve run into a hitch with HubDB when working with a hubspot developer account. I want to use that developer account as a staging area to test my site, but I need to use the HubDB tables from my production account, since those are being managed by our marketing team.

I’m using the basic testing page from the CMS boiler plate: cms-theme-boilerplate/src/templates/hubdb.html at main · HubSpot/cms-theme-boilerplate · GitHub

But I can only specify the ID of the table from my developer account since that’s where my hubspot.config.yml is pointing to, and I don’t want to test by switching my hs watch to my production environment, for obvious reasons.

Is there a way to specify which account to use when pulling down a table using:

hubdb_table_rows( table_id )

Hello @Destnel

Interesting question to which I don’t think there is a good answer…

@Anton , @piersg what do you all think?

Honestly, I have no idea, but I’d love to know if you do come up with a solution for this.

I think generally Hubspot need to do a bit more work on the development workflow to allow for devs to do version control and have a staging environment for testing in the same account as “production” (i.e. not have to use two separate accounts) so we can access all the files, templates, modules, DBs etc that we need. There is Content Staging but that’s only staging for new content, if you want to make changes to a module that is being used live there’s no staging environment for that.

@piersg

I just did a search on giphy for “patience, my pet” because things are advancing for the HubSpot developer :wink:

but, I was met with the following that don’t convey what I meant, but needed to be put in this post.

Dennis Edson, always offering useless content. You are welcome.

via GIPHY

via GIPHY

via GIPHY

39185i3CD499CC1F150E66.gif

just perfect.

:rofl:very tempted to accept this as the solution.

The best solution I’ve come up with so far is to replicate the table and columns from the production tables to the dev tables, then export the CSV of the data from the production tables and import/replace the rows in the dev tables. Not fun, but works when just testing a few items.

@Destnel

Thanks for adding your workaround. If you are feeling crazy you could build this out with the HubDB api, but that might be overkill in terms of effort.

@Destnel,

yeah - the way you’ve found is the only one which is “bulletproof”.

I could think of something with the HubDB APIs. (just theoretical thoughts)

You would need to write a code which would sync the “update a row” API.

So basicly “if row X in HubDB Y(the live environment) is updated, take this informations and pass them to the API to update row Z in HubDB W(dev environment)”. But I think this is extremly overengineered compared to the “export/import a CSV way”.

If you want to try/do this, here’s the HubDB API documentation

best,

Anton

@dennisedson & @piersg You guys just made my day.

@dennisedson how about a giphy integration in the community availible at a certain post/solution number? :grin: