Friday, April 21, 2023
Tuesday, March 28, 2023
What is DBaaS. By - Kapil Sharma
DBaaS stands for Database-as-a-Service. It is a cloud-based service model that provides users with access to a fully managed database system through the internet.
DBaaS allows users to focus on their application development and data analysis without worrying about the underlying infrastructure, maintenance, or administration of the database. Users can select from various database management systems (DBMS) such as MySQL, PostgreSQL, MongoDB, etc., and can scale up or down their database resources based on their requirements.
With DBaaS, users can easily deploy, configure, and manage their databases from a single web-based console or API. The cloud provider is responsible for ensuring high availability, security, backups, and disaster recovery of the database, which makes it a popular choice for businesses of all sizes who want to reduce the cost and complexity of managing their own databases.
Public Source: https://azure.microsoft.com/en-ca/products/category/databases/
Wednesday, March 15, 2023
Object Relational Mapper - By Kapil Sharma
Object Relational Mapper:
An Object Relational Mapper (ORM) is a programming technique that enables the conversion of data between incompatible systems by mapping object-oriented programming concepts to relational database concepts.
In simpler terms, an ORM allows developers to interact with databases using object-oriented programming languages, such as Python or Java, rather than writing complex SQL queries. This approach makes it easier for developers to manage their data and maintain their application code.
ORMs are commonly used in web application development to abstract the complexities of database management and make it easier for developers to work with data. Popular ORM libraries in Python include Django's ORM and SQLAlchemy, while Hibernate is a widely used ORM in Java.
Monday, March 13, 2023
Tools for PB-scale data warehouses management - By Kapil Sharma
Managing PB-scale data warehouses requires a combination of tools for data processing, storage, monitoring, and governance. Here are some popular tools for managing PB-scale data warehouses:
Apache Hadoop: Hadoop is a distributed computing platform that enables the storage and processing of large datasets. It includes Hadoop Distributed File System (HDFS) for storage and MapReduce for distributed processing.
Apache Spark: Spark is an open-source distributed computing platform that provides an interface for programming distributed data processing pipelines. It includes a unified engine for big data processing, real-time streaming, machine learning, and graph processing.
Apache Flink: Flink is a distributed computing platform that provides real-time data processing capabilities. It includes a streaming engine for continuous processing, a batch processing engine for offline processing, and a machine learning library.
Amazon Redshift: Redshift is a cloud-based data warehouse service provided by Amazon Web Services (AWS). It enables the storage and analysis of large datasets using distributed computing and columnar storage.
Google BigQuery: BigQuery is a cloud-based data warehouse service provided by Google Cloud Platform. It enables the storage and analysis of large datasets using a serverless architecture and columnar storage.
Apache Cassandra: Cassandra is a distributed database that enables the storage and retrieval of large amounts of structured and unstructured data. It provides scalability, availability, and fault tolerance.
Apache Kafka: Kafka is a distributed streaming platform that enables the collection, storage, and processing of large streams of data in real-time.
Apache NiFi: NiFi is a data flow management tool that enables the collection, processing, and distribution of data across multiple systems.
Tableau: Tableau is a data visualization and analytics tool that enables users to create interactive dashboards and visualizations from large datasets.
Apache Atlas: Atlas is a data governance and metadata management tool that enables the management of data lineage, data classification, and data security policies.
These are just a few examples of the many tools available for managing PB-scale data warehouses. The choice of tools will depend on the specific needs and requirements of the organization.
Management of PB-scale data warehouses - Kapil Sharma
Managing PB-scale data warehouses requires a combination of technical expertise, efficient processes, and effective tools. Here are some best practices for managing PB-scale data warehouses:
Data modeling: A well-designed data model is essential for a PB-scale data warehouse. It should be optimized for performance, scalability, and flexibility. Consider using a star schema or snowflake schema to organize the data for fast querying and efficient storage.
Distributed computing: PB-scale data warehouses require distributed computing to handle the large volume of data. Use technologies such as Hadoop, Spark, or Apache Flink to distribute the data and processing across multiple servers.
Data partitioning: Partitioning is the process of breaking up data into smaller chunks and distributing them across multiple servers. Partitioning helps to improve performance and scalability by enabling parallel processing and reducing data movement.
Compression: Compressing data can help to reduce storage costs and improve query performance. Consider using compression techniques such as gzip or snappy to compress data.
Data governance: Implement data governance processes to ensure data quality, security, and compliance. This includes establishing data policies, defining data standards, and monitoring data quality.
Monitoring and optimization: Monitor the performance of the PB-scale data warehouse regularly and optimize it as needed. Use tools such as monitoring dashboards, performance tuning, and query optimization to identify and address performance issues.
Disaster recovery and backup: Develop a disaster recovery and backup plan to ensure the availability and reliability of the data warehouse. This includes regular backups, data replication, and testing of the recovery plan.
Managing a PB-scale data warehouse is a complex and challenging task. It requires a team of experts with knowledge of data architecture, distributed computing, big data technologies, and data governance. By following best practices, organizations can effectively manage their PB-scale data warehouses and leverage the data to gain insights and make informed decisions.
PB-Scale data warehouse - By Kapil Sharma
A PB-scale data warehouse is a data warehousing system that can store and process petabytes (PB) of data. This means that it can handle extremely large datasets, making it suitable for companies that need to manage and analyze vast amounts of data.
Data warehouses are designed to store and manage large amounts of data from various sources, and to provide users with the ability to analyze that data to gain insights and make informed decisions. PB-scale data warehouses take this to the next level, with the ability to handle data at a much larger scale than traditional data warehouses.
PB-scale data warehouses typically use distributed computing and storage technologies to handle the large volume of data. This involves breaking up the data into smaller chunks and storing them across multiple servers, which allows for parallel processing and faster query response times.
PB-scale data warehouses are often used by large enterprises that generate and collect massive amounts of data, such as social media platforms, e-commerce companies, and financial institutions. They enable these companies to perform complex data analysis and generate insights at a scale that was previously impossible.
However, building and managing a PB-scale data warehouse is a complex and challenging task. It requires expertise in data architecture, distributed computing, and big data technologies. Additionally, the cost of storing and processing PB-scale data can be significant, as it often requires a large infrastructure and specialized hardware.
CoreML Machine learning framework - By Kapil Sharma
CoreML is a framework developed by Apple that allows developers to integrate machine learning models into their iOS, macOS, and tvOS applications. With CoreML, developers can add machine learning capabilities to their apps without requiring extensive knowledge of machine learning or data science.
CoreML supports a wide range of machine learning models, including neural networks, decision trees, and support vector machines. These models can be trained using a variety of popular machine learning libraries, such as TensorFlow, Keras, and scikit-learn.
Using CoreML, developers can perform tasks such as image and video analysis, natural language processing, and predictive modeling. The framework provides a set of pre-built models that can be used out of the box, as well as tools for converting custom models to the CoreML format.
CoreML is designed to be efficient and optimized for use on mobile devices, with features such as automatic model optimization and hardware acceleration. This means that machine learning models can be run directly on the device, without requiring a connection to a cloud-based service.
Overall, CoreML makes it easier for developers to incorporate machine learning into their applications, allowing them to build more intelligent and personalized experiences for their users.
Diverse datasets for Machine learning - By Kapil Sharma
Diverse datasets are datasets that contain a variety of examples representing a wide range of variations and complexities in the data. This can include variation in data types, such as text, images, audio, or video, as well as variation in the characteristics of the data, such as demographics, language, culture, or geography.
Having diverse datasets is important because it can help to reduce bias in machine learning models and improve their performance. For example, if a machine learning model is trained on a dataset that only includes data from a specific demographic group, it may not perform well on data from other groups.
Diverse datasets can be created by collecting data from a variety of sources and ensuring that the data is representative of the population or problem domain that the model will be applied to. It can also involve intentionally oversampling underrepresented groups to ensure that they are well-represented in the dataset.
In addition to improving model performance, using diverse datasets can also have important ethical implications. For example, if a machine learning model is used to make decisions that affect people's lives, it is important to ensure that the model is not biased against any particular group. Using diverse datasets can help to mitigate this risk and ensure that the model is fair and equitable.
How to productionizing models and implementing machine learning - By Kapil Sharma
Productionizing machine learning models involves taking a trained model and integrating it into a larger system, so that it can be used in real-world applications. Here are some steps to consider when productionizing machine learning models:
Data collection and preprocessing: Collecting and preprocessing the data is an essential step in building any machine learning model. You need to ensure that the data is properly cleaned, normalized, and transformed into the appropriate format for the model.
Model training: Once the data is preprocessed, you can train your machine learning model. This involves selecting the appropriate algorithm, hyperparameters, and training the model on the available data.
Model evaluation: After training, it's important to evaluate the model's performance on a validation dataset. This will help you to identify any issues with the model and tune it for better performance.
Model deployment: Once the model has been trained and evaluated, you need to deploy it in a production environment. This involves integrating the model with the rest of the system, creating an API to interact with the model, and setting up monitoring to ensure that the model is performing as expected.
Model maintenance: Machine learning models require ongoing maintenance to ensure that they continue to perform well. This involves monitoring the model's performance, retraining the model on new data, and updating the model as needed to keep up with changing requirements.
Here are some additional tips to keep in mind when implementing machine learning:
Start small: It's important to start with small, manageable projects when implementing machine learning. This will help you to learn the basics and avoid getting overwhelmed.
Use existing libraries and frameworks: There are many existing machine learning libraries and frameworks available, such as TensorFlow, PyTorch, and scikit-learn. These can save you time and effort when implementing machine learning.
Consider scalability: When implementing machine learning, it's important to consider scalability. Make sure that your system can handle large amounts of data and can scale up as needed.
Choose the right algorithm: There are many different machine learning algorithms to choose from, each with its own strengths and weaknesses. Make sure to choose the algorithm that is best suited to your specific use case.
Keep learning: Machine learning is a rapidly evolving field, and there are always new techniques and technologies to learn. Keep up with the latest developments to stay at the forefront of the field.
Sunday, March 12, 2023
What is data lake - By Kapil Sharma
A data lake is a large, centralized repository that stores all types of structured, semi-structured, and unstructured data at any scale. It is a flexible and cost-effective way to store large volumes of raw data in its native format, without the need to pre-define the structure or schema beforehand.
In a data lake, data is stored in its raw form, as it is generated or acquired by an organization. This means that data can be ingested from a variety of sources, such as sensors, social media, customer interactions, and more.
The data in a data lake can then be processed and analyzed using different tools and technologies, such as data warehouses, machine learning algorithms, and data visualization tools. This allows organizations to gain insights from the data and make data-driven decisions that can improve their business operations, products, and services.
Overall, a data lake provides a way to store and manage large volumes of diverse data, making it a valuable resource for businesses that need to analyze and gain insights from their data.
Sunday, December 26, 2021
What is ETL - Kapil Sharma (Class-102/S2021)
ETL: Extraction, Transform and Load
Wednesday, September 13, 2017
Big Data Analytics (001) - Kapil Sharma
The purpose use for that is known as "ETL" (Extract >> Transform >> Load)
Where data change its shape and usability.
In opensource arena Apache PIG is used for ETL process, this Apache PIG software is not having pretty GUI to easy ETL the process.
After PIG ETL process the Apache HIVE comes in the picture for data analytics.
Apache HIVE used for data warehousing and query the big data sets drive from ETL through Apache PIG system.
I will show you all how to setup Apache PIG and HIVE on your machine in the next write-up. Till than happy coding :)
Thursday, February 23, 2017
Tuesday, December 06, 2016
An HDFS Tutorial for Data Analysts Stuck With Relational Databases
Introduction

SELECT permissions on the relational database, write permissions on the HDFS, and execute permissions on the Sqoop executable.PostgreSQL Data Source
Toptal database, we will create a test data table named sales. We will assume that the OpenSSL certificate and private key files already exist on the PostgreSQL server.Server [localhost]:
Database [postgres]: Toptal
Port [5432]:
Username [postgres]:
Password for user postgres:
psql (9.5.3)
Toptal=# create table sales
Toptal-# (
Toptal(# pkSales integer constraint salesKey primary key,
Toptal(# saleDate date,
Toptal(# saleAmount money,
Toptal(# orderID int not null,
Toptal(# itemID int not null
Toptal(# );
CREATE TABLE
Toptal=# insert into sales values (1, '2016-09-27', 1.23, 1, 1);
INSERT 0 1
Toptal=# insert into sales values (2, '2016-09-27', 2.34, 1, 2);
INSERT 0 1
Toptal=# insert into sales values (3, '2016-09-27', 1.23, 2, 1);
INSERT 0 1
Toptal=# insert into sales values (4, '2016-09-27', 2.34, 2, 2);
INSERT 0 1
Toptal=# insert into sales values (5, '2016-09-27', 3.45, 2, 3);
INSERT 0 1
Toptal=# insert into sales values (6, '2016-09-28', 3.45, 3, 3);
INSERT 0 1
Toptal=# insert into sales values (7, '2016-09-28', 4.56, 3, 4);
INSERT 0 1
Toptal=# insert into sales values (8, '2016-09-28', 5.67, 3, 5);
INSERT 0 1
Toptal=# insert into sales values (9, '2016-09-28', 1.23, 4, 1);
INSERT 0 1
Toptal=# insert into sales values (10, '2016-09-28', 1.23, 5, 1);
INSERT 0 1
Toptal=# insert into sales values (11, '2016-09-28', 1.23, 6, 1);
INSERT 0 1
Toptal=# insert into sales values (12, '2016-09-29', 1.23, 7, 1);
INSERT 0 1
Toptal=# insert into sales values (13, '2016-09-29', 2.34, 7, 2);
INSERT 0 1
Toptal=# insert into sales values (14, '2016-09-29', 3.45, 7, 3);
INSERT 0 1
Toptal=# insert into sales values (15, '2016-09-29', 4.56, 7, 4);
INSERT 0 1
Toptal=# insert into sales values (16, '2016-09-29', 5.67, 7, 5);
INSERT 0 1
Toptal=# insert into sales values (17, '2016-09-29', 6.78, 7, 6);
INSERT 0 1
Toptal=# insert into sales values (18, '2016-09-29', 7.89, 7, 7);
INSERT 0 1
Toptal=# insert into sales values (19, '2016-09-29', 7.89, 8, 7);
INSERT 0 1
Toptal=# insert into sales values (20, '2016-09-30', 1.23, 9, 1);
INSERT 0 1
Toptal=# select * from sales;
pksales | saledate | saleamount | orderid | itemid
---------+------------+------------+---------+--------
1 | 2016-09-27 | $1.23 | 1 | 1
2 | 2016-09-27 | $2.34 | 1 | 2
3 | 2016-09-27 | $1.23 | 2 | 1
4 | 2016-09-27 | $2.34 | 2 | 2
5 | 2016-09-27 | $3.45 | 2 | 3
6 | 2016-09-28 | $3.45 | 3 | 3
7 | 2016-09-28 | $4.56 | 3 | 4
8 | 2016-09-28 | $5.67 | 3 | 5
9 | 2016-09-28 | $1.23 | 4 | 1
10 | 2016-09-28 | $1.23 | 5 | 1
11 | 2016-09-28 | $1.23 | 6 | 1
12 | 2016-09-29 | $1.23 | 7 | 1
13 | 2016-09-29 | $2.34 | 7 | 2
14 | 2016-09-29 | $3.45 | 7 | 3
15 | 2016-09-29 | $4.56 | 7 | 4
16 | 2016-09-29 | $5.67 | 7 | 5
17 | 2016-09-29 | $6.78 | 7 | 6
18 | 2016-09-29 | $7.89 | 7 | 7
19 | 2016-09-29 | $7.89 | 8 | 7
20 | 2016-09-30 | $1.23 | 9 | 1
(20 rows)
Import into the HDFS using Sqoop
sqoop command we will examine is listed below, and we will break down each argument in the bullet points that follow. Note that the command is supposed to be on one complete line or, as shown below, with the backslash (the Linux command line continuation character) at the end of each line except the last.sqoop import --connect 'jdbc:postgresql://aaa.bbb.ccc.ddd:5432/Toptal?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory' \
--username 'postgres' -P \
--table 'sales' \
--target-dir 'sales' \
--split-by 'pksales'
sqoop import- The executable is namedsqoop, and we are instructing it to import the data from a table or view from a database to the HDFS.--connect- With the--connectargument, we are passing in the JDBC connect string for PostgreSQL. In this case, we use the IP address, port number, and database name. We also need to specify that SSL is being utilized and need to supply theSSLSocketFactoryclass to be used.--username- In this example, the username is a PostgreSQL login, not a Windows login. The user must have permissions to connect to the specified database and to select from the specified table.-P- This will prompt the command line user for the password. If Sqoop is rarely executed, this might be a good option. There are multiple other ways to pass the password to the command automatically, but we are trying to keep it simple for this article.--table- This is where we pass in the name of the PostgreSQL table.--target-dir- This argument specifies the HDFS directory where the data is to be stored.--split-by- We must provide Sqoop with a unique identifier to help it distribute the workload. Later in the job output, we will see where Sqoop selects the minimum and maximum values to help set split boundaries.
[hdfs@localhost:/sqoop]$ cat sqoopCommand.sh
sqoop import --connect 'jdbc:postgresql://aaa.bbb.ccc.ddd:5432/toptal?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory' \
--username 'postgres' -P \
--table 'sales' \
--target-dir 'sales' \
--split-by 'pksales'
[hdfs@localhost:/sqoop]$
[hdfs@localhost:/sqoop]$ ./sqoopCommand.sh
16/10/02 18:58:34 INFO sqoop.Sqoop: Running Sqoop version: 1.4.5-cdh5.2.0
Enter password:
16/10/02 18:58:40 INFO manager.SqlManager: Using default fetchSize of 1000
16/10/02 18:58:40 INFO tool.CodeGenTool: Beginning code generation
16/10/02 18:58:41 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM "sales" AS t LIMIT 1
16/10/02 18:58:41 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /usr/lib/hadoop-0.20-mapreduce
Note: /tmp/sqoop-training/compile/77f9452788024792770d52da72ae871f/sales.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
16/10/02 18:58:43 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-training/compile/77f9452788024792770d52da72ae871f/sales.jar
16/10/02 18:58:43 WARN manager.PostgresqlManager: It looks like you are importing from postgresql.
16/10/02 18:58:43 WARN manager.PostgresqlManager: This transfer can be faster! Use the --direct
16/10/02 18:58:43 WARN manager.PostgresqlManager: option to exercise a postgresql-specific fast path.
16/10/02 18:58:43 INFO mapreduce.ImportJobBase: Beginning import of sales
16/10/02 18:58:45 WARN mapred.JobClient: Use GenericOptionsParser for parsing the arguments. Applications should implement Tool for the same.
16/10/02 18:58:46 INFO db.DBInputFormat: Using read commited transaction isolation
16/10/02 18:58:46 INFO db.DataDrivenDBInputFormat: BoundingValsQuery: SELECT MIN("pksales"), MAX("pksales") FROM "sales"
16/10/02 18:58:47 INFO mapred.JobClient: Running job: job_201609280401_0005
16/10/02 18:58:48 INFO mapred.JobClient: map 0% reduce 0%
16/10/02 18:59:04 INFO mapred.JobClient: map 50% reduce 0%
16/10/02 18:59:14 INFO mapred.JobClient: map 75% reduce 0%
16/10/02 18:59:15 INFO mapred.JobClient: map 100% reduce 0%
16/10/02 18:59:18 INFO mapred.JobClient: Job complete: job_201609280401_0005
16/10/02 18:59:18 INFO mapred.JobClient: Counters: 23
16/10/02 18:59:18 INFO mapred.JobClient: File System Counters
16/10/02 18:59:18 INFO mapred.JobClient: FILE: Number of bytes read=0
16/10/02 18:59:18 INFO mapred.JobClient: FILE: Number of bytes written=1190344
16/10/02 18:59:18 INFO mapred.JobClient: FILE: Number of read operations=0
16/10/02 18:59:18 INFO mapred.JobClient: FILE: Number of large read operations=0
16/10/02 18:59:18 INFO mapred.JobClient: FILE: Number of write operations=0
16/10/02 18:59:18 INFO mapred.JobClient: HDFS: Number of bytes read=438
16/10/02 18:59:18 INFO mapred.JobClient: HDFS: Number of bytes written=451
16/10/02 18:59:18 INFO mapred.JobClient: HDFS: Number of read operations=4
16/10/02 18:59:18 INFO mapred.JobClient: HDFS: Number of large read operations=0
16/10/02 18:59:18 INFO mapred.JobClient: HDFS: Number of write operations=4
16/10/02 18:59:18 INFO mapred.JobClient: Job Counters
16/10/02 18:59:18 INFO mapred.JobClient: Launched map tasks=4
16/10/02 18:59:18 INFO mapred.JobClient: Total time spent by all maps in occupied slots (ms)=48877
16/10/02 18:59:18 INFO mapred.JobClient: Total time spent by all reduces in occupied slots (ms)=0
16/10/02 18:59:18 INFO mapred.JobClient: Total time spent by all maps waiting after reserving slots (ms)=0
16/10/02 18:59:18 INFO mapred.JobClient: Total time spent by all reduces waiting after reserving slots (ms)=0
16/10/02 18:59:18 INFO mapred.JobClient: Map-Reduce Framework
16/10/02 18:59:18 INFO mapred.JobClient: Map input records=20
16/10/02 18:59:18 INFO mapred.JobClient: Map output records=20
16/10/02 18:59:18 INFO mapred.JobClient: Input split bytes=438
16/10/02 18:59:18 INFO mapred.JobClient: Spilled Records=0
16/10/02 18:59:18 INFO mapred.JobClient: CPU time spent (ms)=3980
16/10/02 18:59:18 INFO mapred.JobClient: Physical memory (bytes) snapshot=481574912
16/10/02 18:59:18 INFO mapred.JobClient: Virtual memory (bytes) snapshot=2949685248
16/10/02 18:59:18 INFO mapred.JobClient: Total committed heap usage (bytes)=127401984
16/10/02 18:59:18 INFO mapreduce.ImportJobBase: Transferred 451 bytes in 33.7555 seconds (13.3608 bytes/sec)
16/10/02 18:59:18 INFO mapreduce.ImportJobBase: Retrieved 20 records.
[hdfs@localhost:/sqoop]$
hdfs dfs -ls command to see the directory that was created by default with the table name on the HDFS.[hdfs@localhost:/sqoop]$ hdfs dfs -ls
Found 1 items
drwxrwxrwx - toptal data 0 2016-10-02 18:59 sales
[hdfs@localhost:/sqoop]$
hdfs dfs -ls command again to list the contents of the sales directory. If you look on the HDFS, you can notice the data is partitioned and spread across four files by default, not just contained in one.[hdfs@localhost:/sqoop]$ hdfs dfs -ls sales
Found 6 items
-rw-rw-rw- 1 toptal data 0 2016-10-02 18:59 sales/_SUCCESS
drwxrwxrwx - toptal data 0 2016-10-02 18:58 sales/_logs
-rw-rw-rw- 1 toptal data 110 2016-10-02 18:59 sales/part-m-00000
-rw-rw-rw- 1 toptal data 111 2016-10-02 18:59 sales/part-m-00001
-rw-rw-rw- 1 toptal data 115 2016-10-02 18:59 sales/part-m-00002
-rw-rw-rw- 1 toptal data 115 2016-10-02 18:59 sales/part-m-00003
[hdfs@localhost:/sqoop]$
hdfs dfs -cat command will display all of the records in the first partition of the sales data on the HDFS.[hdfs@localhost:/sqoop]$ hdfs dfs -cat sales/part-m-00000
1,2016-09-27,1.23,1,1
2,2016-09-27,2.34,1,2
3,2016-09-27,1.23,2,1
4,2016-09-27,2.34,2,2
5,2016-09-27,3.45,2,3
[hdfs@localhost:/sqoop]$
cat command to the head command as shown below, to check the contents of the other three partitions.-n 5 argument to the head command limits the screen output to the first five rows.[hdfs@localhost:/sqoop]$ hdfs dfs -cat sales/part-m-00001 |head -n 5
6,2016-09-28,3.45,3,3
7,2016-09-28,4.56,3,4
8,2016-09-28,5.67,3,5
9,2016-09-28,1.23,4,1
10,2016-09-28,1.23,5,1
[hdfs@localhost:/sqoop]$ hdfs dfs -cat sales/part-m-00002 |head -n 5
11,2016-09-28,1.23,6,1
12,2016-09-29,1.23,7,1
13,2016-09-29,2.34,7,2
14,2016-09-29,3.45,7,3
15,2016-09-29,4.56,7,4
[hdfs@localhost:/sqoop]$ hdfs dfs -cat sales/part-m-00003 |head -n 5
16,2016-09-29,5.67,7,5
17,2016-09-29,6.78,7,6
18,2016-09-29,7.89,7,7
19,2016-09-29,7.89,8,7
20,2016-09-30,1.23,9,1
[hdfs@localhost:/sqoop]$
[hdfs@localhost:/sqoop]$ cat sqoopCommand.sh
sqoop import --connect 'jdbc:postgresql://aaa.bbb.ccc.ddd:5432/toptal?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory' \
--username 'postgres' -P \
--target-dir 'creditCardOrders' \
--split-by 'pksales' \
--query "select s.pksales, s.saledate, s.saleamount, o.shippingtype, o.methodofpayment from sales s inner join orders o on s.orderid=o.orderid where o.methodofpayment='credit card' and \$CONDITIONS"
[hdfs@localhost:/sqoop]$
--target-dir- The target directory tells Sqoop in which directory on the HDFS to store the selected data. This argument is required by Sqoop when using a free-form query.--split-by- Even though we are selecting the primary key of the sales table, we still have to provide Sqoop with a unique identifier to help it distribute the workload.--query- This is the argument in which we supply the SQL query. The query above is enclosed in double quotes. Notice that there is not a backslash (the line continuation character) in the multiple lines containing the query. Also notice theand \$CONDITIONSat the end of theWHEREclause. This is required by Sqoop because Sqoop will automatically replace the$CONDITIONStoken with a unique expression.
Issues or No Issues: You Should Consider HDFS
-
MonkeyRunner Automation Testing Tool for Android O.S: The monkeyrunner tool provides an API for writing programs that control an Android de...
-
UhuruAppCloud Service: (Exploration Testing) It's a new cloud based application hosting service. Nice and fast UI, I can ...
-
Although the title UI Designer suggests a sort of departure from the traditional graphic designer , UI design is still a part of the hi...
Navigating Portfolio Management Services (PMS): Evaluation, Strategy, and Return Dynamics.
What is Portfolio Management Services (PMS)? Portfolio Management Services (PMS) are customized, professional investment solutions designe...


