Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Modell aus Beispieldaten erstellen
Hier erfahren Sie, wie Sie mit Looker (Google Cloud Core) automatisch ein grundlegendes Datenmodell aus einer Verbindung generieren, die in jeder Instanz enthalten ist.
Jede Looker (Google Cloud Core)-Instanz enthält das LookML-Beispielprojekt, das standardmäßig auf der Instanz installiert ist. Das Beispiel-LookML-Projekt enthält ausgewählte LookML-Modelle, die auf dem öffentlichen BigQuery-Dataset the Look eCommerce basieren. Das Beispiel-LookML-Projekt verwendet eine Verbindung, sample_bigquery_connection. Mit dieser Verbindung können Sie ein neues Datenmodell generieren, das auf einer der Tabellen des Beispielprojekts basiert. Da diese Kurzanleitung nur zu Schulungszwecken dient, löschen Sie das Datenmodell am Ende des Vorgangs.
Hinweis
Für diese Kurzanleitung benötigen Sie Folgendes:
Zugriff auf eine Looker (Google Cloud Core)-Instanz, die das LookML-Beispielprojekt enthält.
Ein Nutzer mit der IAM-Rolle Looker-Administrator muss die BigQuery API für das Google Cloud Projekt aktivieren, das Ihre Looker (Google Cloud Core)-Instanz enthält.
Klicken Sie auf der Startseite von Looker (Google Cloud-Kern) auf das Dreistrich-Menümenu und aktivieren Sie den Entwicklermodus, indem Sie unten im Menü die Option Entwicklermodus aktivieren.
Klicken Sie auf der Startseite von Looker (Google Cloud Core) im Hauptnavigationsmenü auf die Schaltfläche Erstellen, um das Drop-down-Menü zu öffnen.
Wählen Sie im Drop-down-Menü LookML-Modell aus, um die Seite Modell erstellen zu öffnen.
Modell bestimmen
Führen Sie auf der Seite Modell erstellen die folgenden Schritte aus:
Wählen Sie im Abschnitt Datenbankverbindung auswählen im Drop-down-Menü sample_bigquery_connection aus.
Wählen Sie das Optionsfeld aus, um das Modell dem Projekt sample_thelook_ecommerce hinzuzufügen, und klicken Sie auf Weiter.
Lassen Sie im Bereich Tabellen auswählen das Standardprojekt Google Cloud im Feld GCP-Projekt auswählen.
Wählen Sie im Feld Datasets die Option bq_dataset aus.
Klicken Sie auf den Pfeil rechts neben bq_dataset, um das Feld Tabellen aufzurufen.
Wählen Sie im Feld Tables (Tabellen) die Option bq_table aus.
Klicken Sie auf den Pfeil rechts neben bq_table, um das Feld Felder aufzurufen.
Wählen Sie im Feld Felder alle Felder aus und klicken Sie auf Weiter.
Wählen Sie im Abschnitt Primärschlüssel auswählenName als Primärschlüssel aus und klicken Sie auf Weiter.
Wählen Sie im Bereich Zu erstellende Explores auswählen die Datei bq_table.view aus und klicken Sie auf Weiter.
Geben Sie im Bereich Modellnamen eingeben einen eindeutigen Modellnamen ein.
Klicken Sie auf die Schaltfläche Modell vervollständigen und ansehen. Dadurch gelangen Sie zur Looker-IDE.
Modell ansehen
Nachdem Sie alle Felder auf der Seite Modell erstellen ausgefüllt haben, können Sie sich das von Looker generierte Modell ansehen.
Modelldateien in der Looker-IDE aufrufen
Nachdem Sie auf die Schaltfläche Modell fertigstellen und ansehen geklickt haben, werden Sie zur Looker-IDE weitergeleitet. Im Dateibrowser der IDE sehen Sie die Ordner für die vorhandenen Beispiel-LookML-Modelle: 0_start_here, 1_basic_lookml, 2_intermediate_lookml und 3_advanced_lookml. Außerdem sehen Sie die Ordner models und views, die für das generierte Modell erstellt wurden.
Maximieren Sie die Ordner models und views, um die LookML-Dateien zu sehen, die Looker für das Modell erstellt hat, das Sie auf der Seite Modell erstellen definiert haben. Der blaue Punkt neben jeder Datei gibt an, dass es sich um neue Dateien handelt, die noch nicht in der Produktion bereitgestellt wurden.
In der Datei .model wird das Modell definiert. In der Modelldatei sehen Sie die ausgewählte Verbindung, die bq_table-Ansicht sowie andere Standardkonfigurationen.
In der Datei bq_table.view wird die Ansicht definiert. In der Ansichtsdatei sehen Sie die von Ihnen ausgewählten Felder birthdate, name und rating und wie sie in der BigQuery-Datenbanktabelle definiert sind. Außerdem wird ein standardmäßiges count-Maß angezeigt, das von Looker hinzugefügt wurde.
Außerdem sehen Sie die von Looker generierte README.md-Datei, da auf der Seite Modell erstellen standardmäßig das Kästchen Eine Readme-Datei mit weiteren Informationen zur Verwendung von LookML generieren ausgewählt war.
Modell auf der Seite „LookML-Projekte“ ansehen
Öffnen Sie in der IDE das Hauptnavigationsmenü, indem Sie auf das Symbol Hauptmenü klicken.
Wenn Sie sich nicht im Menü Entwickeln befinden, klicken Sie auf Entwickeln.
Wählen Sie im Menü Entwickeln die Option Projekte aus, um die Seite LookML-Projekte aufzurufen.
Sehen Sie sich Ihr Modell in der Spalte Models der Zeile sample_thelook_ecommerce an. Es wird zusammen mit den Modellen advanced_ecomm, basic_ecomm und intermediate_ecomm aus dem Beispiel-LookML-Projekt angezeigt.
Explore aufrufen, das vom Modell erstellt wurde
Klicken Sie auf der Seite Projekte auf den Namen Ihres Modells, um zur Modelldatei in der IDE zurückzukehren.
Klicken Sie in der IDE neben dem Dateinamen oben auf den Pfeil Dateiaktionen ansehen.
Wählen Sie im Drop-down-Menü Explore Bq Table- your_model_name aus. Dadurch gelangen Sie zum Explore Bq-Tabelle, das von Ihrem Modell erstellt wurde.
Notieren Sie sich in der Feldauswahl die Dimensionen Geburtsdatum, Name und Bewertung, die Sie auf der Seite Modell erstellen ausgewählt haben, sowie den Standardmesswert Anzahl.
Um die Looker-Leistung zu maximieren, sollten nicht benötigte Modelle nicht in der Produktion bereitgestellt werden. Um einen sauberen persönlichen Git-Branch zu pflegen und zu verhindern, dass dieses Modell versehentlich in der Produktion bereitgestellt wird, führen Sie die folgenden Schritte aus, um das Modell zu löschen:
Klicken Sie im explorativen Analysetool in der Feldauswahl auf den Link Zu LookML. Dadurch gelangen Sie zur Looker-IDE.
Wählen Sie in der IDE das Symbol Git-Aktionen aus.
Klicken Sie im Menü Git-Aktionen auf Zurück zu.
Achten Sie im Fenster Zurück zu darauf, dass die Option Nicht übernommene Änderungen rückgängig machen ausgewählt ist, und klicken Sie auf Bestätigen.
In der IDE sollten Ihre Modelldateien nicht mehr angezeigt werden.
Wenn Sie die Modellkonfiguration löschen möchten, rufen Sie die Seite Projekte auf. Klicken Sie dazu im Menü Entwickeln auf Projekte.
Suchen Sie in der Tabelle nach Ihrem Modell und klicken Sie in der entsprechenden Zeile auf die Schaltfläche Konfigurieren.
Prüfen Sie, ob Sie sich im Fenster für Ihr Modell befinden, indem Sie den Namen im Feld Modell prüfen. Klicken Sie dann auf Modellkonfiguration löschen.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 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)"]]