

Weitere AWS SDK-Beispiele sind im GitHub Repo [AWS Doc SDK Examples](https://github.com/awsdocs/aws-doc-sdk-examples) verfügbar.

Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.

# AWS Glue Beispiele mit AWS CLI
<a name="cli_2_glue_code_examples"></a>

Die folgenden Codebeispiele zeigen Ihnen, wie Sie mithilfe von AWS Command Line Interface with Aktionen ausführen und allgemeine Szenarien implementieren AWS Glue.

*Aktionen* sind Codeauszüge aus größeren Programmen und müssen im Kontext ausgeführt werden. Während Aktionen Ihnen zeigen, wie Sie einzelne Service-Funktionen aufrufen, können Sie Aktionen im Kontext der zugehörigen Szenarien anzeigen.

Jedes Beispiel enthält einen Link zum vollständigen Quellcode, wo Sie Anweisungen zum Einrichten und Ausführen des Codes im Kodex finden.

**Topics**
+ [Aktionen](#actions)

## Aktionen
<a name="actions"></a>

### `batch-stop-job-run`
<a name="glue_BatchStopJobRun_cli_2_topic"></a>

Das folgende Codebeispiel zeigt, wie Sie`batch-stop-job-run`.

**AWS CLI**  
**So stoppen Sie Auftragsausführungen**  
Im folgenden Beispiel für `batch-stop-job-run` wird eine Auftragsausführung gestoppt.  

```
aws glue batch-stop-job-run \
    --job-name "my-testing-job" \
    --job-run-id jr_852f1de1f29fb62e0ba4166c33970803935d87f14f96cfdee5089d5274a61d3f
```
Ausgabe:  

```
{
    "SuccessfulSubmissions": [
        {
            "JobName": "my-testing-job",
            "JobRunId": "jr_852f1de1f29fb62e0ba4166c33970803935d87f14f96cfdee5089d5274a61d3f"
        }
    ],
    "Errors": [],
    "ResponseMetadata": {
        "RequestId": "66bd6b90-01db-44ab-95b9-6aeff0e73d88",
        "HTTPStatusCode": 200,
        "HTTPHeaders": {
            "date": "Fri, 16 Oct 2020 20:54:51 GMT",
            "content-type": "application/x-amz-json-1.1",
            "content-length": "148",
            "connection": "keep-alive",
            "x-amzn-requestid": "66bd6b90-01db-44ab-95b9-6aeff0e73d88"
        },
        "RetryAttempts": 0
    }
}
```
Weitere Informationen finden Sie unter [Auftragsausführungen](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-jobs-runs.html) im *Entwicklerhandbuch zu AWS Glue*.  
+  Einzelheiten zur API finden Sie [BatchStopJobRun](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/glue/batch-stop-job-run.html)in der *AWS CLI Befehlsreferenz*. 

### `create-connection`
<a name="glue_CreateConnection_cli_2_topic"></a>

Das folgende Codebeispiel zeigt die Verwendung`create-connection`.

**AWS CLI**  
**Um eine Verbindung für AWS Glue-Datenspeicher herzustellen**  
Das folgende `create-connection` Beispiel erstellt eine Verbindung im AWS Glue-Datenkatalog, die Verbindungsinformationen für einen Kafka-Datenspeicher bereitstellt.  

```
aws glue create-connection \
    --connection-input '{ \
        "Name":"conn-kafka-custom", \
        "Description":"kafka connection with ssl to custom kafka", \
        "ConnectionType":"KAFKA",  \
        "ConnectionProperties":{  \
            "KAFKA_BOOTSTRAP_SERVERS":"<Kafka-broker-server-url>:<SSL-Port>", \
            "KAFKA_SSL_ENABLED":"true", \
            "KAFKA_CUSTOM_CERT": "s3://bucket/prefix/cert-file.pem" \
        }, \
        "PhysicalConnectionRequirements":{ \
            "SubnetId":"subnet-1234", \
            "SecurityGroupIdList":["sg-1234"], \
            "AvailabilityZone":"us-east-1a"} \
    }' \
    --region us-east-1
    --endpoint https://glue.us-east-1.amazonaws.com
```
Mit diesem Befehl wird keine Ausgabe zurückgegeben.  
Weitere Informationen finden Sie unter [Verbindungen im AWS Glue-Datenkatalog definieren](https://docs.aws.amazon.com/glue/latest/dg/populate-add-connection.html) im *AWS Glue-Entwicklerhandbuch*.  
+  Einzelheiten zur API finden Sie [CreateConnection](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/glue/create-connection.html)in der *AWS CLI Befehlsreferenz*. 

### `create-database`
<a name="glue_CreateDatabase_cli_2_topic"></a>

Das folgende Codebeispiel zeigt die Verwendung`create-database`.

**AWS CLI**  
**So erstellen Sie eine Datenbank**  
Das folgende `create-database` Beispiel erstellt eine Datenbank im AWS Glue-Datenkatalog.  

```
aws glue create-database \
    --database-input "{\"Name\":\"tempdb\"}" \
    --profile my_profile \
    --endpoint https://glue.us-east-1.amazonaws.com
```
Mit diesem Befehl wird keine Ausgabe zurückgegeben.  
Weitere Informationen finden Sie unter [Definieren einer Datenbank in Ihrem Datenkatalog](https://docs.aws.amazon.com/glue/latest/dg/define-database.html) im *Entwicklerhandbuch zu AWS Glue*.  
+  Einzelheiten zur API finden Sie [CreateDatabase](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/glue/create-database.html)in der *AWS CLI Befehlsreferenz*. 

### `create-job`
<a name="glue_CreateJob_cli_2_topic"></a>

Das folgende Codebeispiel zeigt die Verwendung`create-job`.

**AWS CLI**  
**Einen Auftrag zur Datentransformation erstellen**  
Im folgenden Beispiel für `create-job` wird ein Streaming-Job erstellt, der ein in S3 gespeichertes Skript ausführt.  

```
aws glue create-job \
    --name my-testing-job \
    --role AWSGlueServiceRoleDefault \
    --command '{ \
        "Name": "gluestreaming", \
        "ScriptLocation": "s3://amzn-s3-demo-bucket/folder/" \
    }' \
    --region us-east-1 \
    --output json \
    --default-arguments '{ \
        "--job-language":"scala", \
        "--class":"GlueApp" \
    }' \
    --profile my-profile \
    --endpoint https://glue.us-east-1.amazonaws.com
```
Inhalt von `test_script.scala`:  

```
import com.amazonaws.services.glue.ChoiceOption
import com.amazonaws.services.glue.GlueContext
import com.amazonaws.services.glue.MappingSpec
import com.amazonaws.services.glue.ResolveSpec
import com.amazonaws.services.glue.errors.CallSite
import com.amazonaws.services.glue.util.GlueArgParser
import com.amazonaws.services.glue.util.Job
import com.amazonaws.services.glue.util.JsonOptions
import org.apache.spark.SparkContext
import scala.collection.JavaConverters._

object GlueApp {
    def main(sysArgs: Array[String]) {
        val spark: SparkContext = new SparkContext()
        val glueContext: GlueContext = new GlueContext(spark)
        // @params: [JOB_NAME]
        val args = GlueArgParser.getResolvedOptions(sysArgs, Seq("JOB_NAME").toArray)
        Job.init(args("JOB_NAME"), glueContext, args.asJava)
        // @type: DataSource
        // @args: [database = "tempdb", table_name = "s3-source", transformation_ctx = "datasource0"]
        // @return: datasource0
        // @inputs: []
        val datasource0 = glueContext.getCatalogSource(database = "tempdb", tableName = "s3-source", redshiftTmpDir = "", transformationContext = "datasource0").getDynamicFrame()
        // @type: ApplyMapping
        // @args: [mapping = [("sensorid", "int", "sensorid", "int"), ("currenttemperature", "int", "currenttemperature", "int"), ("status", "string", "status", "string")], transformation_ctx = "applymapping1"]
        // @return: applymapping1
        // @inputs: [frame = datasource0]
        val applymapping1 = datasource0.applyMapping(mappings = Seq(("sensorid", "int", "sensorid", "int"), ("currenttemperature", "int", "currenttemperature", "int"), ("status", "string", "status", "string")), caseSensitive = false, transformationContext = "applymapping1")
        // @type: SelectFields
        // @args: [paths = ["sensorid", "currenttemperature", "status"], transformation_ctx = "selectfields2"]
        // @return: selectfields2
        // @inputs: [frame = applymapping1]
        val selectfields2 = applymapping1.selectFields(paths = Seq("sensorid", "currenttemperature", "status"), transformationContext = "selectfields2")
        // @type: ResolveChoice
        // @args: [choice = "MATCH_CATALOG", database = "tempdb", table_name = "my-s3-sink", transformation_ctx = "resolvechoice3"]
        // @return: resolvechoice3
        // @inputs: [frame = selectfields2]
        val resolvechoice3 = selectfields2.resolveChoice(choiceOption = Some(ChoiceOption("MATCH_CATALOG")), database = Some("tempdb"), tableName = Some("my-s3-sink"), transformationContext = "resolvechoice3")
        // @type: DataSink
        // @args: [database = "tempdb", table_name = "my-s3-sink", transformation_ctx = "datasink4"]
        // @return: datasink4
        // @inputs: [frame = resolvechoice3]
        val datasink4 = glueContext.getCatalogSink(database = "tempdb", tableName = "my-s3-sink", redshiftTmpDir = "", transformationContext = "datasink4").writeDynamicFrame(resolvechoice3)
        Job.commit()
    }
}
```
Ausgabe:  

```
{
    "Name": "my-testing-job"
}
```
Weitere Informationen finden Sie unter [Authoring Jobs in AWS Glue im AWS Glue](https://docs.aws.amazon.com/glue/latest/dg/author-job.html) *Developer Guide*.  
+  Einzelheiten zur API finden Sie [CreateJob](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/glue/create-job.html)in der *AWS CLI Befehlsreferenz.* 

### `create-table`
<a name="glue_CreateTable_cli_2_topic"></a>

Das folgende Codebeispiel zeigt die Verwendung`create-table`.

**AWS CLI**  
**Beispiel 1: So erstellen Sie eine Tabelle für einen Kinesis-Datenstrom**  
Das folgende `create-table` Beispiel erstellt eine Tabelle im AWS Glue-Datenkatalog, die einen Kinesis-Datenstrom beschreibt.  

```
aws glue create-table \
    --database-name tempdb \
    --table-input  '{"Name":"test-kinesis-input", "StorageDescriptor":{ \
            "Columns":[ \
                {"Name":"sensorid", "Type":"int"}, \
                {"Name":"currenttemperature", "Type":"int"}, \
                {"Name":"status", "Type":"string"}
            ], \
            "Location":"my-testing-stream", \
            "Parameters":{ \
                "typeOfData":"kinesis","streamName":"my-testing-stream", \
                "kinesisUrl":"https://kinesis.us-east-1.amazonaws.com" \
            }, \
            "SerdeInfo":{ \
                "SerializationLibrary":"org.openx.data.jsonserde.JsonSerDe"} \
        }, \
        "Parameters":{ \
            "classification":"json"} \
        }' \
    --profile my-profile \
    --endpoint https://glue.us-east-1.amazonaws.com
```
Mit diesem Befehl wird keine Ausgabe zurückgegeben.  
Weitere Informationen finden Sie unter [Definieren von Tabellen im AWS Glue-Datenkatalog](https://docs.aws.amazon.com/glue/latest/dg/tables-described.html) im *AWS Glue-Entwicklerhandbuch*.  
**Beispiel 2: So erstellen Sie eine Tabelle für einen Kafka-Datenspeicher**  
Das folgende `create-table` Beispiel erstellt eine Tabelle im AWS Glue-Datenkatalog, die einen Kafka-Datenspeicher beschreibt.  

```
aws glue create-table \
    --database-name tempdb \
    --table-input  '{"Name":"test-kafka-input", "StorageDescriptor":{ \
            "Columns":[ \
                {"Name":"sensorid", "Type":"int"}, \
                {"Name":"currenttemperature", "Type":"int"}, \
                {"Name":"status", "Type":"string"}
            ], \
            "Location":"glue-topic", \
            "Parameters":{ \
                "typeOfData":"kafka","topicName":"glue-topic", \
                "connectionName":"my-kafka-connection"
            }, \
            "SerdeInfo":{ \
                "SerializationLibrary":"org.apache.hadoop.hive.serde2.OpenCSVSerde"} \
        }, \
        "Parameters":{ \
            "separatorChar":","} \
        }' \
    --profile my-profile \
    --endpoint https://glue.us-east-1.amazonaws.com
```
Mit diesem Befehl wird keine Ausgabe zurückgegeben.  
Weitere Informationen finden Sie unter [Definieren von Tabellen im AWS Glue-Datenkatalog](https://docs.aws.amazon.com/glue/latest/dg/tables-described.html) im *AWS Glue-Entwicklerhandbuch*.  
**Beispiel 3: So erstellen Sie eine Tabelle für einen AWS S3-Datenspeicher**  
Das folgende `create-table` Beispiel erstellt eine Tabelle im AWS Glue Data Catalog, die einen AWS Simple Storage Service (AWS S3) -Datenspeicher beschreibt.  

```
aws glue create-table \
    --database-name tempdb \
    --table-input  '{"Name":"s3-output", "StorageDescriptor":{ \
            "Columns":[ \
                {"Name":"s1", "Type":"string"}, \
                {"Name":"s2", "Type":"int"}, \
                {"Name":"s3", "Type":"string"}
            ], \
            "Location":"s3://bucket-path/", \
            "SerdeInfo":{ \
                "SerializationLibrary":"org.openx.data.jsonserde.JsonSerDe"} \
        }, \
        "Parameters":{ \
            "classification":"json"} \
        }' \
    --profile my-profile \
    --endpoint https://glue.us-east-1.amazonaws.com
```
Mit diesem Befehl wird keine Ausgabe zurückgegeben.  
Weitere Informationen finden Sie unter [Definieren von Tabellen im AWS Glue-Datenkatalog](https://docs.aws.amazon.com/glue/latest/dg/tables-described.html) im *AWS Glue-Entwicklerhandbuch*.  
+  Einzelheiten zur API finden Sie [CreateTable](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/glue/create-table.html)in der *AWS CLI Befehlsreferenz*. 

### `delete-job`
<a name="glue_DeleteJob_cli_2_topic"></a>

Das folgende Codebeispiel zeigt die Verwendung`delete-job`.

**AWS CLI**  
**Einen Auftrag löschen**  
Das folgende Beispiel für `delete-job` löscht einen Auftrag, der nicht mehr benötigt wird.  

```
aws glue delete-job \
    --job-name my-testing-job
```
Ausgabe:  

```
{
    "JobName": "my-testing-job"
}
```
Weitere Informationen finden Sie unter [Arbeiten mit Jobs auf der AWS Glue-Konsole](https://docs.aws.amazon.com/glue/latest/dg/console-jobs.html) im *AWS Glue-Entwicklerhandbuch*.  
+  Einzelheiten zur API finden Sie [DeleteJob](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/glue/delete-job.html)in der *AWS CLI Befehlsreferenz*. 

### `get-databases`
<a name="glue_GetDatabases_cli_2_topic"></a>

Das folgende Codebeispiel zeigt die Verwendung`get-databases`.

**AWS CLI**  
**Um die Definitionen einiger oder aller Datenbanken im AWS Glue-Datenkatalog aufzulisten**  
Das folgende Beispiel für `get-databases` gibt Informationen über die Datenbanken im Datenkatalog zurück.  

```
aws glue get-databases
```
Ausgabe:  

```
{
    "DatabaseList": [
        {
            "Name": "default",
            "Description": "Default Hive database",
            "LocationUri": "file:/spark-warehouse",
            "CreateTime": 1602084052.0,
            "CreateTableDefaultPermissions": [
                {
                    "Principal": {
                        "DataLakePrincipalIdentifier": "IAM_ALLOWED_PRINCIPALS"
                    },
                    "Permissions": [
                        "ALL"
                    ]
                }
            ],
            "CatalogId": "111122223333"
        },
        {
            "Name": "flights-db",
            "CreateTime": 1587072847.0,
            "CreateTableDefaultPermissions": [
                {
                    "Principal": {
                        "DataLakePrincipalIdentifier": "IAM_ALLOWED_PRINCIPALS"
                    },
                    "Permissions": [
                        "ALL"
                    ]
                }
            ],
            "CatalogId": "111122223333"
        },
        {
            "Name": "legislators",
            "CreateTime": 1601415625.0,
            "CreateTableDefaultPermissions": [
                {
                    "Principal": {
                        "DataLakePrincipalIdentifier": "IAM_ALLOWED_PRINCIPALS"
                    },
                    "Permissions": [
                        "ALL"
                    ]
                }
            ],
            "CatalogId": "111122223333"
        },
        {
            "Name": "tempdb",
            "CreateTime": 1601498566.0,
            "CreateTableDefaultPermissions": [
                {
                    "Principal": {
                        "DataLakePrincipalIdentifier": "IAM_ALLOWED_PRINCIPALS"
                    },
                    "Permissions": [
                        "ALL"
                    ]
                }
            ],
            "CatalogId": "111122223333"
        }
    ]
}
```
Weitere Informationen finden Sie unter [Definieren einer Datenbank in Ihrem Datenkatalog](https://docs.aws.amazon.com/glue/latest/dg/define-database.html) im *Entwicklerhandbuch zu AWS Glue*.  
+  Einzelheiten zur API finden Sie [GetDatabases](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/glue/get-databases.html)in der *AWS CLI Befehlsreferenz*. 

### `get-job-run`
<a name="glue_GetJobRun_cli_2_topic"></a>

Das folgende Codebeispiel zeigt die Verwendung`get-job-run`.

**AWS CLI**  
**Informationen zu einer Auftragsausführung abrufen**  
Das folgende Beispiel für `get-job-run` ruft Informationen zu einer Auftragsausführung ab.  

```
aws glue get-job-run \
    --job-name "Combine legistators data" \
    --run-id jr_012e176506505074d94d761755e5c62538ee1aad6f17d39f527e9140cf0c9a5e
```
Ausgabe:  

```
{
    "JobRun": {
        "Id": "jr_012e176506505074d94d761755e5c62538ee1aad6f17d39f527e9140cf0c9a5e",
        "Attempt": 0,
        "JobName": "Combine legistators data",
        "StartedOn": 1602873931.255,
        "LastModifiedOn": 1602874075.985,
        "CompletedOn": 1602874075.985,
        "JobRunState": "SUCCEEDED",
        "Arguments": {
            "--enable-continuous-cloudwatch-log": "true",
            "--enable-metrics": "",
            "--enable-spark-ui": "true",
            "--job-bookmark-option": "job-bookmark-enable",
            "--spark-event-logs-path": "s3://aws-glue-assets-111122223333-us-east-1/sparkHistoryLogs/"
        },
        "PredecessorRuns": [],
        "AllocatedCapacity": 10,
        "ExecutionTime": 117,
        "Timeout": 2880,
        "MaxCapacity": 10.0,
        "WorkerType": "G.1X",
        "NumberOfWorkers": 10,
        "LogGroupName": "/aws-glue/jobs",
        "GlueVersion": "2.0"
    }
}
```
Weitere Informationen finden Sie unter [Auftragsausführungen](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-jobs-runs.html) im *Entwicklerhandbuch zu AWS Glue*.  
+  Einzelheiten zur API finden Sie [GetJobRun](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/glue/get-job-run.html)in der *AWS CLI Befehlsreferenz*. 

### `get-job-runs`
<a name="glue_GetJobRuns_cli_2_topic"></a>

Das folgende Codebeispiel zeigt die Verwendung`get-job-runs`.

**AWS CLI**  
**Informationen über alle Ausführungen eines Auftrags abrufen**  
Das folgende Beispiel für `get-job-runs` ruft Informationen zu allen Ausführungen eines Auftrags ab.  

```
aws glue get-job-runs \
    --job-name "my-testing-job"
```
Ausgabe:  

```
{
    "JobRuns": [
        {
            "Id": "jr_012e176506505074d94d761755e5c62538ee1aad6f17d39f527e9140cf0c9a5e",
            "Attempt": 0,
            "JobName": "my-testing-job",
            "StartedOn": 1602873931.255,
            "LastModifiedOn": 1602874075.985,
            "CompletedOn": 1602874075.985,
            "JobRunState": "SUCCEEDED",
            "Arguments": {
                "--enable-continuous-cloudwatch-log": "true",
                "--enable-metrics": "",
                "--enable-spark-ui": "true",
                "--job-bookmark-option": "job-bookmark-enable",
                "--spark-event-logs-path": "s3://aws-glue-assets-111122223333-us-east-1/sparkHistoryLogs/"
            },
            "PredecessorRuns": [],
            "AllocatedCapacity": 10,
            "ExecutionTime": 117,
            "Timeout": 2880,
            "MaxCapacity": 10.0,
            "WorkerType": "G.1X",
            "NumberOfWorkers": 10,
            "LogGroupName": "/aws-glue/jobs",
            "GlueVersion": "2.0"
        },
        {
            "Id": "jr_03cc19ddab11c4e244d3f735567de74ff93b0b3ef468a713ffe73e53d1aec08f_attempt_2",
            "Attempt": 2,
            "PreviousRunId": "jr_03cc19ddab11c4e244d3f735567de74ff93b0b3ef468a713ffe73e53d1aec08f_attempt_1",
            "JobName": "my-testing-job",
            "StartedOn": 1602811168.496,
            "LastModifiedOn": 1602811282.39,
            "CompletedOn": 1602811282.39,
            "JobRunState": "FAILED",
            "ErrorMessage": "An error occurred while calling o122.pyWriteDynamicFrame.
                Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied;
                Request ID: 021AAB703DB20A2D;
                S3 Extended Request ID: teZk24Y09TkXzBvMPG502L5VJBhe9DJuWA9/TXtuGOqfByajkfL/Tlqt5JBGdEGpigAqzdMDM/U=)",
            "PredecessorRuns": [],
            "AllocatedCapacity": 10,
            "ExecutionTime": 110,
            "Timeout": 2880,
            "MaxCapacity": 10.0,
            "WorkerType": "G.1X",
            "NumberOfWorkers": 10,
            "LogGroupName": "/aws-glue/jobs",
            "GlueVersion": "2.0"
        },
        {
            "Id": "jr_03cc19ddab11c4e244d3f735567de74ff93b0b3ef468a713ffe73e53d1aec08f_attempt_1",
            "Attempt": 1,
            "PreviousRunId": "jr_03cc19ddab11c4e244d3f735567de74ff93b0b3ef468a713ffe73e53d1aec08f",
            "JobName": "my-testing-job",
            "StartedOn": 1602811020.518,
            "LastModifiedOn": 1602811138.364,
            "CompletedOn": 1602811138.364,
            "JobRunState": "FAILED",
            "ErrorMessage": "An error occurred while calling o122.pyWriteDynamicFrame.
                 Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied;
                 Request ID: 2671D37856AE7ABB;
                 S3 Extended Request ID: RLJCJw20brV+PpC6GpORahyF2fp9flB5SSb2bTGPnUSPVizLXRl1PN3QZldb+v1o9qRVktNYbW8=)",
            "PredecessorRuns": [],
            "AllocatedCapacity": 10,
            "ExecutionTime": 113,
            "Timeout": 2880,
            "MaxCapacity": 10.0,
            "WorkerType": "G.1X",
            "NumberOfWorkers": 10,
            "LogGroupName": "/aws-glue/jobs",
            "GlueVersion": "2.0"
        }
    ]
}
```
Weitere Informationen finden Sie unter [Auftragsausführungen](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-jobs-runs.html) im *Entwicklerhandbuch zu AWS Glue*.  
+  Einzelheiten zur API finden Sie [GetJobRuns](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/glue/get-job-runs.html)in der *AWS CLI Befehlsreferenz*. 

### `get-job`
<a name="glue_GetJob_cli_2_topic"></a>

Das folgende Codebeispiel zeigt die Verwendung`get-job`.

**AWS CLI**  
**Informationen zu einem Auftrag abrufen**  
Das folgende Beispiel für `get-job` ruft Informationen zu einem Auftrag ab.  

```
aws glue get-job \
    --job-name my-testing-job
```
Ausgabe:  

```
{
    "Job": {
        "Name": "my-testing-job",
        "Role": "Glue_DefaultRole",
        "CreatedOn": 1602805698.167,
        "LastModifiedOn": 1602805698.167,
        "ExecutionProperty": {
            "MaxConcurrentRuns": 1
        },
        "Command": {
            "Name": "gluestreaming",
            "ScriptLocation": "s3://janetst-bucket-01/Scripts/test_script.scala",
            "PythonVersion": "2"
        },
        "DefaultArguments": {
            "--class": "GlueApp",
            "--job-language": "scala"
        },
        "MaxRetries": 0,
        "AllocatedCapacity": 10,
        "MaxCapacity": 10.0,
        "GlueVersion": "1.0"
    }
}
```
Weitere Informationen finden Sie unter [Aufträge](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-jobs-job.html) im *Entwicklerhandbuch zu AWS Glue*.  
+  Einzelheiten zur API finden Sie [GetJob](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/glue/get-job.html)in der *AWS CLI Befehlsreferenz*. 

### `get-plan`
<a name="glue_GetPlan_cli_2_topic"></a>

Das folgende Codebeispiel zeigt die Verwendung`get-plan`.

**AWS CLI**  
**So rufen Sie den generierten Code für die Zuweisung von Daten aus Quelltabellen zu Zieltabellen ab**  
Im folgenden Beispiel für `get-plan` wird der generierte Code für die Zuweisung von Spalten aus der Datenquelle zum Datenziel abgerufen.  

```
aws glue get-plan --mapping '[ \
    { \
        "SourcePath":"sensorid", \
        "SourceTable":"anything", \
        "SourceType":"int", \
        "TargetPath":"sensorid", \
        "TargetTable":"anything", \
        "TargetType":"int" \
    }, \
    { \
        "SourcePath":"currenttemperature", \
        "SourceTable":"anything", \
        "SourceType":"int", \
        "TargetPath":"currenttemperature", \
        "TargetTable":"anything", \
        "TargetType":"int" \
    }, \
    { \
        "SourcePath":"status", \
        "SourceTable":"anything", \
        "SourceType":"string", \
        "TargetPath":"status", \
        "TargetTable":"anything", \
        "TargetType":"string" \
    }]' \
    --source '{ \
        "DatabaseName":"tempdb", \
        "TableName":"s3-source" \
    }' \
    --sinks '[ \
        { \
            "DatabaseName":"tempdb", \
            "TableName":"my-s3-sink" \
        }]'
    --language "scala"
    --endpoint https://glue.us-east-1.amazonaws.com
    --output "text"
```
Ausgabe:  

```
import com.amazonaws.services.glue.ChoiceOption
import com.amazonaws.services.glue.GlueContext
import com.amazonaws.services.glue.MappingSpec
import com.amazonaws.services.glue.ResolveSpec
import com.amazonaws.services.glue.errors.CallSite
import com.amazonaws.services.glue.util.GlueArgParser
import com.amazonaws.services.glue.util.Job
import com.amazonaws.services.glue.util.JsonOptions
import org.apache.spark.SparkContext
import scala.collection.JavaConverters._

object GlueApp {
  def main(sysArgs: Array[String]) {
    val spark: SparkContext = new SparkContext()
    val glueContext: GlueContext = new GlueContext(spark)
    // @params: [JOB_NAME]
    val args = GlueArgParser.getResolvedOptions(sysArgs, Seq("JOB_NAME").toArray)
    Job.init(args("JOB_NAME"), glueContext, args.asJava)
    // @type: DataSource
    // @args: [database = "tempdb", table_name = "s3-source", transformation_ctx = "datasource0"]
    // @return: datasource0
    // @inputs: []
    val datasource0 = glueContext.getCatalogSource(database = "tempdb", tableName = "s3-source", redshiftTmpDir = "", transformationContext = "datasource0").getDynamicFrame()
    // @type: ApplyMapping
    // @args: [mapping = [("sensorid", "int", "sensorid", "int"), ("currenttemperature", "int", "currenttemperature", "int"), ("status", "string", "status", "string")], transformation_ctx = "applymapping1"]
    // @return: applymapping1
    // @inputs: [frame = datasource0]
    val applymapping1 = datasource0.applyMapping(mappings = Seq(("sensorid", "int", "sensorid", "int"), ("currenttemperature", "int", "currenttemperature", "int"), ("status", "string", "status", "string")), caseSensitive = false, transformationContext = "applymapping1")
    // @type: SelectFields
    // @args: [paths = ["sensorid", "currenttemperature", "status"], transformation_ctx = "selectfields2"]
    // @return: selectfields2
    // @inputs: [frame = applymapping1]
    val selectfields2 = applymapping1.selectFields(paths = Seq("sensorid", "currenttemperature", "status"), transformationContext = "selectfields2")
    // @type: ResolveChoice
    // @args: [choice = "MATCH_CATALOG", database = "tempdb", table_name = "my-s3-sink", transformation_ctx = "resolvechoice3"]
    // @return: resolvechoice3
    // @inputs: [frame = selectfields2]
    val resolvechoice3 = selectfields2.resolveChoice(choiceOption = Some(ChoiceOption("MATCH_CATALOG")), database = Some("tempdb"), tableName = Some("my-s3-sink"), transformationContext = "resolvechoice3")
    // @type: DataSink
    // @args: [database = "tempdb", table_name = "my-s3-sink", transformation_ctx = "datasink4"]
    // @return: datasink4
    // @inputs: [frame = resolvechoice3]
    val datasink4 = glueContext.getCatalogSink(database = "tempdb", tableName = "my-s3-sink", redshiftTmpDir = "", transformationContext = "datasink4").writeDynamicFrame(resolvechoice3)
    Job.commit()
  }
}
```
Weitere Informationen finden Sie unter [Editing Scripts in AWS Glue](https://docs.aws.amazon.com/glue/latest/dg/edit-script.html) im *AWS Glue Developer Guide*.  
+  Einzelheiten zur API finden Sie [GetPlan](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/glue/get-plan.html)in der *AWS CLI Befehlsreferenz*. 

### `get-tables`
<a name="glue_GetTables_cli_2_topic"></a>

Das folgende Codebeispiel zeigt die Verwendung`get-tables`.

**AWS CLI**  
**Die Definitionen einiger oder aller Tabellen in der angegebenen Datenbank auflisten**  
Das folgende Beispiel für `get-tables` gibt Informationen zu den Tabellen in der angegebenen Datenbank zurück.  

```
aws glue get-tables --database-name 'tempdb'
```
Ausgabe:  

```
{
    "TableList": [
        {
            "Name": "my-s3-sink",
            "DatabaseName": "tempdb",
            "CreateTime": 1602730539.0,
            "UpdateTime": 1602730539.0,
            "Retention": 0,
            "StorageDescriptor": {
                "Columns": [
                    {
                        "Name": "sensorid",
                        "Type": "int"
                    },
                    {
                        "Name": "currenttemperature",
                        "Type": "int"
                    },
                    {
                        "Name": "status",
                        "Type": "string"
                    }
                ],
                "Location": "s3://janetst-bucket-01/test-s3-output/",
                "Compressed": false,
                "NumberOfBuckets": 0,
                "SerdeInfo": {
                    "SerializationLibrary": "org.openx.data.jsonserde.JsonSerDe"
                },
                "SortColumns": [],
                "StoredAsSubDirectories": false
            },
            "Parameters": {
                "classification": "json"
            },
            "CreatedBy": "arn:aws:iam::007436865787:user/JRSTERN",
            "IsRegisteredWithLakeFormation": false,
            "CatalogId": "007436865787"
        },
        {
            "Name": "s3-source",
            "DatabaseName": "tempdb",
            "CreateTime": 1602730658.0,
            "UpdateTime": 1602730658.0,
            "Retention": 0,
            "StorageDescriptor": {
                "Columns": [
                    {
                        "Name": "sensorid",
                        "Type": "int"
                    },
                    {
                        "Name": "currenttemperature",
                        "Type": "int"
                    },
                    {
                        "Name": "status",
                        "Type": "string"
                    }
                ],
                "Location": "s3://janetst-bucket-01/",
                "Compressed": false,
                "NumberOfBuckets": 0,
                "SortColumns": [],
                "StoredAsSubDirectories": false
            },
            "Parameters": {
                "classification": "json"
            },
            "CreatedBy": "arn:aws:iam::007436865787:user/JRSTERN",
            "IsRegisteredWithLakeFormation": false,
            "CatalogId": "007436865787"
        },
        {
            "Name": "test-kinesis-input",
            "DatabaseName": "tempdb",
            "CreateTime": 1601507001.0,
            "UpdateTime": 1601507001.0,
            "Retention": 0,
            "StorageDescriptor": {
                "Columns": [
                    {
                        "Name": "sensorid",
                        "Type": "int"
                    },
                    {
                        "Name": "currenttemperature",
                        "Type": "int"
                    },
                    {
                        "Name": "status",
                        "Type": "string"
                    }
                ],
                "Location": "my-testing-stream",
                "Compressed": false,
                "NumberOfBuckets": 0,
                "SerdeInfo": {
                    "SerializationLibrary": "org.openx.data.jsonserde.JsonSerDe"
                },
                "SortColumns": [],
                "Parameters": {
                    "kinesisUrl": "https://kinesis.us-east-1.amazonaws.com",
                    "streamName": "my-testing-stream",
                    "typeOfData": "kinesis"
                },
                "StoredAsSubDirectories": false
            },
            "Parameters": {
                "classification": "json"
            },
            "CreatedBy": "arn:aws:iam::007436865787:user/JRSTERN",
            "IsRegisteredWithLakeFormation": false,
            "CatalogId": "007436865787"
        }
    ]
}
```
Weitere Informationen finden Sie unter [Definieren von Tabellen im AWS Glue-Datenkatalog](https://docs.aws.amazon.com/glue/latest/dg/tables-described.html) im *AWS Glue-Entwicklerhandbuch*.  
+  Einzelheiten zur API finden Sie [GetTables](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/glue/get-tables.html)in der *AWS CLI Befehlsreferenz*. 

### `start-crawler`
<a name="glue_StartCrawler_cli_2_topic"></a>

Das folgende Codebeispiel zeigt die Verwendung`start-crawler`.

**AWS CLI**  
**Einen Crawler starten**  
Das folgende Beispiel für `start-crawler` startet einen Crawler.  

```
aws glue start-crawler --name my-crawler
```
Ausgabe:  

```
None
```
Weitere Informationen finden Sie unter [Definieren von Crawlern](https://docs.aws.amazon.com/glue/latest/dg/add-crawler.html) im *Entwicklerhandbuch zu AWS Glue*.  
+  Einzelheiten zur API finden Sie [StartCrawler](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/glue/start-crawler.html)in der *AWS CLI Befehlsreferenz*. 

### `start-job-run`
<a name="glue_StartJobRun_cli_2_topic"></a>

Das folgende Codebeispiel zeigt die Verwendung`start-job-run`.

**AWS CLI**  
**Die Auftragsausführung starten**  
Das folgende Beispiel für `start-job-run` startet die Ausführung eines Auftrags.  

```
aws glue start-job-run \
    --job-name my-job
```
Ausgabe:  

```
{
    "JobRunId": "jr_22208b1f44eb5376a60569d4b21dd20fcb8621e1a366b4e7b2494af764b82ded"
}
```
Weitere Informationen finden Sie unter [Autorisieren von Aufträgen](https://docs.aws.amazon.com/glue/latest/dg/author-job.html) im *Entwicklerhandbuch zu AWS Glue*.  
+  Einzelheiten zur API finden Sie [StartJobRun](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/glue/start-job-run.html)in der *AWS CLI Befehlsreferenz*. 