CMS Development

Destnel
Participant

Specify different account for HubDB table

SOLVE

Background info:

 

I'm using a developer account to build my site using the continous integration method outlined here: https://developers.hubspot.com/docs/cms/guides/github-integration

 

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: https://github.com/HubSpot/cms-theme-boilerplate/blob/main/src/templates/hubdb.html

 

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 )

 

1 Accepted solution
Destnel
Solution
Participant

Specify different account for HubDB table

SOLVE

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.

View solution in original post

9 Replies 9
Anton
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Specify different account for HubDB table

SOLVE

@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? 😁

 

 

 

Anton Bujanowski Signature
Destnel
Solution
Participant

Specify different account for HubDB table

SOLVE

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.

dennisedson
HubSpot Product Team
HubSpot Product Team

Specify different account for HubDB table

SOLVE

@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. 

dennisedson
HubSpot Product Team
HubSpot Product Team

Specify different account for HubDB table

SOLVE

Hello @Destnel 

Interesting question to which I don't think there is a good answer...

@Anton , @piersg  what do you all think?

0 Upvotes
piersg
Key Advisor

Specify different account for HubDB table

SOLVE

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.

dennisedson
HubSpot Product Team
HubSpot Product Team

Specify different account for HubDB table

SOLVE

@piersg 

I just did a search on giphy for "patience, my pet" because things are advancing for the HubSpot developer 😉

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

Destnel
Participant

Specify different account for HubDB table

SOLVE

🤣very tempted to accept this as the solution.

piersg
Key Advisor

Specify different account for HubDB table

SOLVE

giphy

dennisedson
HubSpot Product Team
HubSpot Product Team

Specify different account for HubDB table

SOLVE

just perfect.

0 Upvotes