09.10.2023 Views

Advanced Data Analytics Using Python_ With Machine Learning, Deep Learning and NLP Examples ( 2023)

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 2

ETL with Python (Structured Data)

cols = sys.stdin.readline().strip()

out.write("columns=" + cols + "\n")

out.write("source end"+"\n")

print "Enter the Data Source Type:"

print "1. MySql"

print "2. Text"

print "3. Exit"

if(int(data1) == 3):

out.close()

sys.exit()

Elasticsearch

The Elasticsearch (ES) low-level client gives a direct mapping from

Python to ES REST endpoints. One of the big advantages of Elasticsearch

is that it provides a full stack solution for data analysis in one place.

Elasticsearch is the database. It has a configurable front end called

Kibana, a data collection tool called Logstash, and an enterprise security

feature called Shield.

This example has the features called cat, cluster, indices, ingest,

nodes, snapshot, and tasks that translate to instances of CatClient,

ClusterClient, IndicesClient, CatClient, ClusterClient,

IndicesClient, IngestClient, NodesClient, SnapshotClient,

NodesClient, SnapshotClient, and TasksClient, respectively. These

instances are the only supported way to get access to these classes and

their methods.

You can specify your own connection class, which can be used by

providing the connection_class parameter.

# create connection to local host using the ThriftConnection

Es1=Elasticsearch(connection_class=ThriftConnection)

31

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!