LookML being deleted when setting GIT connection

Hi everyone,

lately I am finding an issue that im not sure if its an expected behaviour, but its uncomfortable: while in development mode (before deploying to production) I set up the connection with the database, and define models and explores, and it works fine.

The issue is that, after I set up the connection with Git (in order to deploy to production) I lose all the lookml files, its empty now, as if it pulled from the git repository and, as it was empty, lookml was emptied too.

Is there a way, when you first connect to git, to push the LookML files in git, rather than pulling the empty git in looker? Since I find that I lose all the previous work and I need to recreate it again after the connection with git is done.

Thanks in advance,
best regards

Solved Solved
0 7 688
1 ACCEPTED SOLUTION

I think I kind of understand what is happening and I was able to re-create the issue you have recorded in the video link.

Looker needs a repo to store the metadata, it either has to be a git repo or a bare repo. If you create the project and setup the bare repo shown below, the model will not get deleted. As we create a blank project and add a model file, it does not gets stored in any repo as there is no repo (The save button creates a impression of model getting saved, but its actually just getting saved at browser level) and that is why the model gets overwritten when we configure a git repo in the project. Actually, if there is some content in the git repo already then the model file will be overwritten by it and that content will start showing up.

And if you want your content to not get deleted, then you will have to setup a bare repo using below indicated link.

L_F_11.PNG

 

 

 

 

 

 

 

 

 

Hope this helps

~Ashish

View solution in original post

7 REPLIES 7

Hey @carlosavendano ,

You might be having same issue mentioned in Model-missing . 

Currently, I don't see any way to preserve code other than saving those files locally. Then need to connect to Git and paste the files into the repo again.

Hi,

thank you for the answers!

This is an expected behaviour then, not a bug? Since I find it really annoying: when you connect to the database, Looker automatically generates a LookML model with views , dimensions and some measures for each table in the database...you will lose all of that after you set up the connection with git? The unique solution is to manually paste all the LookML files in GIT before the sync? Clients would not like that process I think.

Thank you,

best regards

Hi @carlosavendano 

I have done this multiple times but never lost the project content. I usually create a blank project and then add connection, views, models and explores in it. One everything is working, I log into Github and create new repository for this project and save the URL of the repo and create the 'personal access token' (Only once) in github.com (Link). 

Come back to the Looker project and go to Project settings -> setup Git Connection. Then paste the repo URL and personal access token and save the project. Come the the  'File Browser' and push the code to the repository.

L_F_8.PNG

 

 

 

 

 

 

 

 

 

 

 

 

Hope this helps.

~Ashish

Hi Ashish,

I always create the project with the option "Generate Model from Database Schema" since you get the model and views already created. Anyway, I have tried with the blank project option, and I find the same issue: when you connect with GIT, as this repository is empty, the LookML gets empty too, as explained by other people in the thread  Model-missing

I create manually the model, after that I connect with GIT, and my LookML gets deleted. Here its a brief example that I have just recorded

I think I kind of understand what is happening and I was able to re-create the issue you have recorded in the video link.

Looker needs a repo to store the metadata, it either has to be a git repo or a bare repo. If you create the project and setup the bare repo shown below, the model will not get deleted. As we create a blank project and add a model file, it does not gets stored in any repo as there is no repo (The save button creates a impression of model getting saved, but its actually just getting saved at browser level) and that is why the model gets overwritten when we configure a git repo in the project. Actually, if there is some content in the git repo already then the model file will be overwritten by it and that content will start showing up.

And if you want your content to not get deleted, then you will have to setup a bare repo using below indicated link.

L_F_11.PNG

 

 

 

 

 

 

 

 

 

Hope this helps

~Ashish

Hi Ashish

Thank you for your answer!

Indeed, if you create the project with the bare repo option, LookML files wont be deleted, and that works fine.

The issue is that some clients want to have it in an external repo (such as github), and with this they will also have additional features like pull request required, so the bare repo wont be enough.

Anyway, I have just done the test and, if you create a bare repo, and after that you reset the git connection and link to your external github repo, it works fine without removing anything, so that would be the way of connecting to an external repo without losing the LookML files while doing it, although its a bit more complicated that it should.

Thank you for your support! 

Ya, that is what I meant, we need to first create a bare repo and then switch it to git repo and no content will be lost.

~AShish

Top Labels in this Space
Top Solution Authors