This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| LOAD DATABASE | |
| FROM mysql://<mysql_user>:<mysql_password>@<mysql_host>/<source_databases> | |
| INTO pgsql://<postgres_user>:<postgres_password>@<postgres_host>/<target_database> | |
| WITH INCLUDE DROP, CREATE TABLES | |
| SET search_path to 'public' | |
| INCLUDING ONLY TABLE NAMES MATCHING 'sample_table' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Acquiring state lock. This may take a few moments... | |
| Error: Error locking state: Error acquiring the state lock: ConditionalCheckFailedException: The conditional request failed | |
| status code: 400, request id: L2CH7KK3QCAEHSC1TJ1VLBMNBRVV4CQNSO5AEMVJY66Q9ASUAAJN | |
| Lock Info: | |
| ID: 21e2b2bb-c123-2383-eece-7a5eaab4f645 | |
| Path: s3/path/to/the/state/file | |
| Operation: OperationTypePlan | |
| Who: username@hostname | |
| Version: 0.11.14 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT * | |
| FROM information_schema.innodb_trx | |
| WHERE trx_mysql_thread_id = CONNECTION_ID()\G |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT | |
| pid, | |
| now() - pg_stat_activity.query_start AS duration, | |
| query, | |
| state | |
| FROM pg_stat_activity | |
| WHERE (now() - pg_stat_activity.query_start) > interval '5 minutes' | |
| ORDER BY duration DESC; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "aws_db_instance" "mydb" { | |
| engine = "mysql" | |
| engine_version = "5.6.40" | |
| instance_class = "db.t1.micro" | |
| name = "initial_db" | |
| username = "example" | |
| password = "1234" | |
| allocated_storage = "20" | |
| publicly_accessible = "true" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CALL mysql.rds_reset_external_master; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| IAB1 | Arts & Entertainment | |
|---|---|---|
| IAB1-1 | Books & Literature | |
| IAB1-2 | Celebrity Fan/Gossip | |
| IAB1-3 | Fine Art | |
| IAB1-4 | Humor | |
| IAB1-5 | Movies | |
| IAB1-6 | Music | |
| IAB1-7 | Television | |
| IAB2 | Automotive | |
| IAB2-1 | Auto Parts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <project xmlns="http://maven.apache.org/POM/4.0.0" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| <modelVersion>4.0.0</modelVersion> | |
| <groupId>org.dedunu.datascience</groupId> | |
| <artifactId>sample</artifactId> | |
| <version>1.0-SNAPSHOT</version> | |
| <packaging>jar</packaging> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package org.dedunu.datascience.sample | |
| import org.apache.spark.{SparkContext, SparkConf} | |
| object Driver { | |
| def main(args: Array[String]): Unit = { | |
| val sparkConf = new SparkConf().setAppName("Sample Job Name") | |
| val sparkContext = new SparkContext(sparkConf) | |
| val textFile = sparkContext.textFile("file://" + args(0) + "/*") | |
| val counts = textFile.flatMap(line => line.split(" ")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import boto3 | |
| __author__ = 'dedunu' | |
| connection = boto3.client( | |
| 'emr', | |
| region_name='us-west-1', | |
| aws_access_key_id='<Your AWS Access Key>', | |
| aws_secret_access_key='<You AWS Secred Key>', | |
| ) |