Object Oriented Programming
Networking
Linux/Unix
Object Oriented Programming
(OOP)
In Python, a class is a template for a data type. A
class can be defined using the class keyword.
We define a class in a very similar way to how we
define a function. Just like a function, we use
parentheses and a colon after the class name (():)
when we define a class. Similarly, the body of our
class is indented like a function's body is.
Python Class
This is function
This is class
In Python, a class needs to be instantiated before use.
As an analogy, a class can be thought of as a blueprint (Car), and an instance
is an actual implementation of the blueprint (Ferrari).
Instantiate Python Class
In Python, class variables are defined outside of all methods and have the
same value for every instance of the class.
Class variables are accessed with the instance.variable or
class_name.variable syntaxes.
Python Class Variables
In Python, methods are functions that
are defined as part of a class. It is
common practice that the first
argument of any method that is part of
a class is the actual object calling the
method. This argument is usually called
self.
Python class methods
In Python, the .__init__() method is
used to initialize a newly created
object. It is called every time the
class is instantiated.
Python init method
Python Inheritance
Subclassing in Python, also known as
“inheritance”, allows classes to share
the same attributes and methods from
a parent or superclass. Inheritance in
Python can be accomplished by
putting the superclass name between
parentheses after the subclass or child
class name.
In the example code block, the Dog
class subclasses the Animal class,
inheriting all of its attributes.
Overriding in Python
In Python, inheritance allows for method
overriding, which lets a child class
change and redefine the implementation
of methods already defined in its parent
class.
The following example code block
creates a ParentClass and a ChildClass
which both define a print_test() method.
As the ChildClass inherits from the
ParentClass, the method print_test() will
be overridden by ChildClasssuch that it
prints the word “Child” instead of
“Parent”.
Super() Function in Python Inheritance
Python’s super() function allows a subclass to invoke its parent’s version of an
overridden method.
Networking
Why Networking?
As a Data Engineer, even though it is not required to
understand networking in detail, but it is necessary to
understand at least the surface topic of networking as it
will help data engineer to understand how the data
used every day transferred and connected
One communication flow consist of:
1. Sent request
2. Get response
Type of Network
LAN: Local Area Network, network in one area
MAN: Metropolitan Area Network, network in a city, consist of several LAN
WAN: Wide Area Network, consist of several MAN
Data Engineer Focus
Understanding LAN
Understanding how LAN works
Understanding troubleshooting LAN
Important Terminology
DNS: Technology that translate an IP Address into
an easy remember name. For example IP 23.345.23
into google.com
VPN: Enable us to create a direct connection, so we
establish a more secure connection. Best practice is
that we should use VPN whenever we are going to
access data.
Information needed when connect to database
IP Address / IP host
Port
Username
Password
VPN Account
Shell Command
print Working Directory
The shell command pwd displays the file path from the root directory to the
current working directory.
mkdir Make Directory
ls List
The shell command ls is used to list the contents of a directory
The shell command cd is used to move
throughout the filesystem of a computer. It
accepts a variety of arguments:
Full file paths.
Names of children of the current directory.
.. the parent of the current directory.
cd Change Directory
touch Create New File
The shell command touch creates a new file in the current
working directory with the name provided.
cp Copy
cp is used to copy files or directories.
The basic argument structure is cp source destination, where the source is the
file/directory to copy to the destination file/directory.
mv Move
mv is used to move a file into a directory.
Syntax:
Mv (file to be moved) (target directory)
rm Remove
rm is used to delete files and directories. The -r flag deletes a directory
and all of its files and directories (rm -r).
ls List Command Options
The shell command ls is used to list the contents in a directory. It can be
combined with the following command options:
-a: lists all contents, including hidden files and directories.
-l: lists all contents, in long format.
-t: lists all contents, by the time they were last modified.
cat Display
cat displays the contents of one or more files to the terminal.
grep Search
grep is used to search files for lines that match a pattern and returns
the results. Various options can be specified along with the grep
command to specify the search.
The | command is called a pipe. It is used to pipe, or transfer, the standard
output from the command on its left into the standard input of the
command on its right.
Pipe shell command
PIPELINE TEAM
Ines Desdemarsa
Novita Sari

OOP, Networking, Linux/Unix

  • 1.
  • 2.
  • 3.
    In Python, aclass is a template for a data type. A class can be defined using the class keyword. We define a class in a very similar way to how we define a function. Just like a function, we use parentheses and a colon after the class name (():) when we define a class. Similarly, the body of our class is indented like a function's body is. Python Class This is function This is class
  • 4.
    In Python, aclass needs to be instantiated before use. As an analogy, a class can be thought of as a blueprint (Car), and an instance is an actual implementation of the blueprint (Ferrari). Instantiate Python Class
  • 5.
    In Python, classvariables are defined outside of all methods and have the same value for every instance of the class. Class variables are accessed with the instance.variable or class_name.variable syntaxes. Python Class Variables
  • 6.
    In Python, methodsare functions that are defined as part of a class. It is common practice that the first argument of any method that is part of a class is the actual object calling the method. This argument is usually called self. Python class methods
  • 7.
    In Python, the.__init__() method is used to initialize a newly created object. It is called every time the class is instantiated. Python init method
  • 8.
    Python Inheritance Subclassing inPython, also known as “inheritance”, allows classes to share the same attributes and methods from a parent or superclass. Inheritance in Python can be accomplished by putting the superclass name between parentheses after the subclass or child class name. In the example code block, the Dog class subclasses the Animal class, inheriting all of its attributes.
  • 9.
    Overriding in Python InPython, inheritance allows for method overriding, which lets a child class change and redefine the implementation of methods already defined in its parent class. The following example code block creates a ParentClass and a ChildClass which both define a print_test() method. As the ChildClass inherits from the ParentClass, the method print_test() will be overridden by ChildClasssuch that it prints the word “Child” instead of “Parent”.
  • 10.
    Super() Function inPython Inheritance Python’s super() function allows a subclass to invoke its parent’s version of an overridden method.
  • 11.
  • 12.
    Why Networking? As aData Engineer, even though it is not required to understand networking in detail, but it is necessary to understand at least the surface topic of networking as it will help data engineer to understand how the data used every day transferred and connected One communication flow consist of: 1. Sent request 2. Get response
  • 13.
    Type of Network LAN:Local Area Network, network in one area MAN: Metropolitan Area Network, network in a city, consist of several LAN WAN: Wide Area Network, consist of several MAN Data Engineer Focus Understanding LAN Understanding how LAN works Understanding troubleshooting LAN
  • 14.
    Important Terminology DNS: Technologythat translate an IP Address into an easy remember name. For example IP 23.345.23 into google.com VPN: Enable us to create a direct connection, so we establish a more secure connection. Best practice is that we should use VPN whenever we are going to access data. Information needed when connect to database IP Address / IP host Port Username Password VPN Account
  • 15.
  • 16.
    print Working Directory Theshell command pwd displays the file path from the root directory to the current working directory. mkdir Make Directory
  • 17.
    ls List The shellcommand ls is used to list the contents of a directory The shell command cd is used to move throughout the filesystem of a computer. It accepts a variety of arguments: Full file paths. Names of children of the current directory. .. the parent of the current directory. cd Change Directory
  • 18.
    touch Create NewFile The shell command touch creates a new file in the current working directory with the name provided.
  • 19.
    cp Copy cp isused to copy files or directories. The basic argument structure is cp source destination, where the source is the file/directory to copy to the destination file/directory.
  • 20.
    mv Move mv isused to move a file into a directory. Syntax: Mv (file to be moved) (target directory)
  • 21.
    rm Remove rm isused to delete files and directories. The -r flag deletes a directory and all of its files and directories (rm -r).
  • 22.
    ls List CommandOptions The shell command ls is used to list the contents in a directory. It can be combined with the following command options: -a: lists all contents, including hidden files and directories. -l: lists all contents, in long format. -t: lists all contents, by the time they were last modified.
  • 23.
    cat Display cat displaysthe contents of one or more files to the terminal.
  • 24.
    grep Search grep isused to search files for lines that match a pattern and returns the results. Various options can be specified along with the grep command to specify the search.
  • 25.
    The | commandis called a pipe. It is used to pipe, or transfer, the standard output from the command on its left into the standard input of the command on its right. Pipe shell command
  • 26.