Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Gerar um modelo a partir de dados de amostra
Saiba como usar o Looker (Google Cloud Core) para gerar automaticamente um modelo de dados básico com base em uma conexão incluída em cada instância.
Cada instância do Looker (núcleo do Google Cloud) vem com o exemplo de projeto do LookML, que é instalado por padrão na instância. O projeto de exemplo do LookML inclui modelos selecionados do LookML com base no conjunto de dados público do BigQuery the Look eCommerce. O exemplo de projeto do LookML usa uma conexão, sample_bigquery_connection. Você pode usar essa conexão para gerar um novo modelo de dados com base em uma das tabelas do projeto de exemplo. Como este início rápido é apenas para fins instrutivos, você vai excluir o modelo de dados no final do processo.
Antes de começar
Para acompanhar este tutorial, você vai precisar do seguinte:
Alguém com o papel do IAM de Administrador do Looker precisa ativar a API BigQuery para o projeto Google Cloud que contém a instância do Looker (Google Cloud Core).
Na página inicial do Looker (Google Cloud Core), clique no ícone Menu principal do Looker menu e ative o modo de desenvolvimento selecionando a opção Modo de desenvolvimento na parte de baixo do menu.
Na página inicial do Looker (Google Cloud Core), clique no botão Criar no menu de navegação principal para abrir o menu suspenso.
No menu suspenso, selecione Modelo do LookML para abrir a página Criar um modelo.
Defina seu modelo
Na página Criar um modelo, siga estas etapas:
Na seção Selecionar conexão de banco de dados, selecione sample_bigquery_connection no menu suspenso.
Selecione o botão de opção para adicionar o modelo ao projeto sample_thelook_ecommerce e clique em Próxima.
Na seção Selecionar tabelas, deixe o projeto Google Cloud padrão no campo Selecionar projeto do GCP.
No campo Conjuntos de dados, selecione bq_dataset.
Clique na seta à direita de bq_dataset para acessar o campo Tabelas.
No campo Tabelas, selecione bq_table.
Clique na seta à direita de bq_table para acessar o campo Campos.
No campo Campos, selecione todos os campos e clique em Próxima.
Na seção Selecionar chaves primárias, selecione Nome como a chave primária e clique em Próxima.
Na seção Selecionar análises para criar, selecione o arquivo bq_table.view e clique em Próxima.
Na seção Enter Model Name, insira um nome exclusivo para o modelo.
Clique no botão Concluir e conferir modelo. Essa ação leva você ao ambiente de desenvolvimento integrado do Looker.
Conferir o modelo
Depois de preencher todos os campos na página Criar um modelo, confira o modelo gerado pelo Looker.
Conferir os arquivos do modelo no ambiente de desenvolvimento integrado do Looker
Depois de clicar no botão Complete and View Model, você vai acessar o ambiente de desenvolvimento integrado do Looker. No navegador de arquivos do ambiente de desenvolvimento integrado, você encontra as pastas dos modelos de exemplo do LookML, que são 0_start_here, 1_basic_lookml, 2_intermediate_lookml e 3_advanced_lookml. Você também vai encontrar as pastas criadas para o modelo gerado, models e views.
Abra as pastas models e views para conferir os arquivos LookML que o Looker criou para o modelo que você definiu na página Criar um modelo. O ponto azul ao lado de cada arquivo indica que eles são novos e ainda não foram implantados na produção.
O arquivo .modeldefine o modelo. No arquivo de modelo, é possível ver a conexão selecionada, a visualização bq_table e outras configurações padrão.
O arquivo bq_table.viewdefine a visualização. No arquivo de visualização, você pode conferir os campos birthdate, name e rating selecionados e como eles são definidos na tabela do banco de dados do BigQuery, além de uma medida count padrão que o Looker adicionou.
Você também vai encontrar o arquivo README.md gerado pelo Looker porque a caixa de seleção Generate a Readme file that gives more information about using LookML na página Create a Model foi selecionada por padrão.
Acessar o modelo na página "Projetos do LookML"
No ambiente de desenvolvimento integrado, abra o menu de navegação principal clicando no ícone Main menu.
Se você ainda não estiver no menu Develop, clique em Develop.
No menu Develop, selecione Projects para acessar a página LookML Projects.
Confira seu modelo na coluna Models da linha sample_thelook_ecommerce. Ele aparece com os modelos advanced_ecomm, basic_ecomm e intermediate_ecomm do projeto de exemplo do LookML.
Conferir a Análise detalhada criada pelo modelo
Na página Projects, clique no nome do modelo para voltar ao arquivo no ambiente de desenvolvimento integrado.
Com o arquivo de modelo aberto no ambiente de desenvolvimento integrado, clique na seta Ver ações do arquivo ao lado do nome do arquivo na parte de cima do ambiente.
Selecione Analisar tabela do BQ - nome_do_modelo no menu suspenso. Essa seleção leva você à análise detalhada Bq Table criada pelo seu modelo.
No seletor de campos, observe as dimensões Data de nascimento, Nome e Nota que você selecionou na página Criar um modelo, bem como a medida padrão Contagem.
Os arquivos de modelo, a configuração do modelo e a seção "Explorar" que você acessou só ficam disponíveis no seu ramo do Git pessoal no modo de desenvolvimento. Se você quiser disponibilizar esse modelo para outros usuários na sua instância do Looker (núcleo do Google Cloud), comete as mudanças, mescle a ramificação e implante a ramificação de produção. No entanto, para os fins deste início rápido, você vai excluir esse modelo, conforme descrito na próxima seção.
Limpar
Para maximizar a performance do Looker, não implante modelos desnecessários na produção. Para manter uma ramificação pessoal do Git limpa e evitar a implantação acidental do modelo na produção, siga estas etapas para excluí-lo:
Na seção "Explorar", clique no link Acessar LookML no seletor de campos. Essa ação leva você ao ambiente de desenvolvimento integrado do Looker.
No ambiente de desenvolvimento integrado, selecione o ícone Ações do Git.
No menu Ações do Git, clique em Reverter para.
Na janela Reverter para, verifique se a opção Reverter alterações não confirmadas está selecionada e clique em Confirmar.
No ambiente de desenvolvimento integrado, os arquivos do modelo não vão mais aparecer.
Para excluir a configuração do modelo, acesse a página Projects clicando em Projects no menu Develop.
Localize seu modelo na tabela e clique no botão Configurar na linha dele.
Verifique se você está na janela do modelo verificando o nome no campo Model e clique em Excluir configuração do modelo.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-25 UTC."],[],[],null,["# Quickstart: Generate a model from sample data\n\nGenerate a model from sample data\n=================================\n\nLearn how to use Looker (Google Cloud core) to automatically generate a basic data model from a connection that is included in each instance.\n\nEach Looker (Google Cloud core) instance comes with the [sample LookML project](/looker/docs/looker-core-sample-project) that is installed by default on the instance. The sample LookML project includes curated LookML models that are based on the [public BigQuery dataset `the Look eCommerce`](https://console.cloud.google.com/marketplace/product/bigquery-public-data/thelook-ecommerce). The sample LookML project uses a [connection](/looker/docs/connecting-to-your-db), `sample_bigquery_connection`. You can use this connection to generate a new data model that is based on one of the sample project's tables. Since this quickstart is for instructional purposes only, you'll delete the data model at the end of the process.\n| **Tip:** To generate a model using your own connection and real data, follow the steps on the [Generating a LookML model](/looker/docs/generating-a-model) documentation page.\n\nBefore you begin\n----------------\n\nTo follow along with this quickstart, you'll need the following:\n\n- Access to a Looker (Google Cloud core) instance that includes the [sample LookML project](/looker/docs/looker-core-sample-project).\n- Someone with the [**Looker Admin** IAM role](/looker/docs/looker-core-access-control#iam-roles) must enable the BigQuery API for the Google Cloud project that contains your Looker (Google Cloud core) instance.\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=bigquery.googleapis.com)\n- You must have either the [**Looker Admin**](/looker/docs/admin-panel-users-roles#default_roles) role or the [`develop` permission](/looker/docs/admin-panel-users-roles#develop).\n\nNavigate to the Create a Model page\n-----------------------------------\n\n1. On the Looker (Google Cloud core) homepage, click the Looker **Main menu** icon menu and enable Development Mode by selecting the **Development Mode** toggle at the bottom of the menu.\n2. On the Looker (Google Cloud core) homepage, click the **Create** button in the main navigation menu to open the drop-down menu.\n3. From the drop-down menu, select **LookML Model** to open the **Create a Model** page.\n\nDefine your model\n-----------------\n\nOn the **Create a Model** page, follow these steps:\n\n1. In the **Select Database Connection** section, select `sample_bigquery_connection` from the drop-down menu.\n2. Select the radio button to add the model to the `sample_thelook_ecommerce` project, and click **Next**.\n3. In the **Select Tables** section, leave the default Google Cloud project in the **Select GCP project** field.\n4. In the **Datasets** field, select `bq_dataset`.\n5. Click the arrow to the right of `bq_dataset` to get to the **Tables** field.\n6. In the **Tables** field, select `bq_table`.\n7. Click the arrow to the right of `bq_table` to get to the **Fields** field.\n8. In the **Fields** field, select all the fields, and click **Next**.\n9. In the **Select Primary Keys** section, select **Name** as the primary key, and click **Next**.\n10. In the **Select Explores to Create** section, select the `bq_table.view` file, and click **Next**.\n11. In the **Enter Model Name** section, enter a unique model name.\n12. Click the **Complete and View Model** button. This action takes you to the Looker IDE.\n\nView your model\n---------------\n\nOnce you've completed all fields in the **Create a Model** page, view the model that Looker generated.\n\n### View the model files in the Looker IDE\n\n1. After clicking the **Complete and View Model** button, you will be in the Looker IDE. In the IDE file browser, you see the folders for the pre-existing sample LookML models, which are `0_start_here`, `1_basic_lookml`, `2_intermediate_lookml`, and `3_advanced_lookml`. You also see the folders created for the generated model, `models` and `views`.\n2. Expand the `models` and `views` folders to see the LookML files that Looker created for the model that you defined on the **Create a Model** page. The blue dot next to each file indicates that they are new files and not yet deployed to production.\n - The `.model` file [defines the model](/looker/docs/lookml-project-files#model_files). In the model file, you can see the connection that you selected, the `bq_table` view, as well as other default configurations.\n - The `bq_table.view` file [defines the view](/looker/docs/lookml-project-files#view_files). In the view file, you can see the `birthdate`, `name`, and `rating` fields that you selected and how they are defined in the BigQuery database table, as well as a default `count` measure that Looker added.\n3. You also see the `README.md` file that Looker generated because the **Generate a Readme file that gives more information about using LookML** checkbox on the **Create a Model** page was selected by default.\n\n### View the model on the LookML Projects page\n\n1. From the IDE, open the main navigation menu by clicking the **Main menu** icon.\n2. If you aren't already in the **Develop** menu, click **Develop**.\n3. From the **Develop** menu, select **Projects** to navigate to the [**LookML Projects** page](/looker/docs/manage-projects).\n4. View your model in the **Models** column of the **sample_thelook_ecommerce** row. It appears along with the `advanced_ecomm`, `basic_ecomm`, and `intermediate_ecomm` models from the sample LookML project.\n\n### View the Explore that was created by the model\n\n1. From the **Projects** page, click the name of your model to return to the model file in the IDE.\n2. With the model file open in the IDE, click the **See file actions** arrow next to the filename at the top of the IDE.\n3. Select **Explore Bq Table- your_model_name** from the drop-down menu. This selection takes you to the **Bq Table** Explore that was created by your model.\n4. In the field picker, note the **Birthdate Date** , **Name** , and **Rating** dimensions that you selected on this **Create a Model** page, as well as the default **Count** measure.\n\n| **Note:** The model that has been generated doesn't contain data, so running a query on the Explore will return no results.\n\nThe model files, model configuration, and Explore that you've viewed are available only in your [personal Git branch](/looker/docs/version-control-and-deploying-changes#working_with_git_branches) while in Development Mode. If you wanted to make this model available to other users in your Looker (Google Cloud core) instance, you would [commit your changes, merge your branch, and deploy the production branch](/looker/docs/version-control-and-deploying-changes#getting_your_changes_to_production). However, for the purposes of this quickstart, you will delete this model, as described in the next section.\n\nClean up\n--------\n\nTo maximize Looker performance, unnecessary models shouldn't be deployed to production. To maintain a clean personal Git branch and avoid accidentally deploying this model to production, complete the following steps to delete the model:\n\n1. From the Explore, click the **Go to LookML** link in the field picker. This action takes you to the Looker IDE.\n2. In IDE, select the **Git Actions** icon.\n3. In the **Git Actions** menu, click **Revert to**.\n4. In the **Revert to** window, make sure that the **Revert uncommitted changes** option is selected, and click **Confirm**.\n\n | **Tip:** If you want to see if there are other changes in your working branch, click **View Changes** before clicking **Confirm**.\n5. In the IDE, you should no longer see your model files.\n\n6. To delete the model configuration, navigate to the **Projects** page by clicking **Projects** in the **Develop** menu.\n\n7. Locate your model in the table, and click the **Configure** button in its row.\n\n8. Make sure you are in the window for your model by checking the name in the **Model** field, and click **Delete Model Configuration**.\n\nWhat's next\n-----------\n\n- [Generating a LookML model](/looker/docs/generating-a-model)\n- [Looker IDE overview](/looker/docs/looker-ide)\n- [Managing LookML files and folders](/looker/docs/creating-project-files)\n- [Common LookML patterns](/looker/docs/additional-lookml-basics)\n- [Using version control and deploying](/looker/docs/version-control-and-deploying-changes)"]]