HBASE Vs. RDBMS Top Differences You can Unlock Now

Image
HBASE in the Big data context has a lot of benefits over RDBMS. The listed differences below make you understandable why HBASE is popular in Hadoop (or Bigdata) platform. Let us check one by one quickly. HBASE Vs. RDBMS Differences Random Accessing HBase handles a large amount of data that is store in a distributed manner in the column-oriented format while RDBMS is systematic storage of a database that cannot support a random manner for accessing the database. Database Rules RDBMS strictly follow Codd's 12 rules with fixed schemas and row-oriented manner of database and also follow ACID properties. HBase follows BASE properties and implement complex queries. Secondary indexes, complex inner and outer joins, count, sum, sort, group, and data of page and table can easily be accessible by RDBMS. Storage From small to medium storage application there is the use of RDBMS that provide the solution with MySQL and PostgreSQL whose size increase with concurrency and performance.  Codd'

Python: How to Create a Class Useful Mini Project

Sample logic to create class

PYTHON Supports Classes as part of Object-Oriented Programming Capabilities. You can create an Object from the Class. Also, you can use the methods of that.  

Mini Project: Python Class Writing in 5 Steps

1. My Sample Python Code

Sample Code: Here, the below code gives indentation errors. I have later corrected in my program.

class Employee:
 'Base class'
 empCount = 0

 def __init__(self, name, salary):
  self.name = name
  self.salary = salary
  Employee.empCount += 1
# can also be written as Employee.empCount = Employee.empCount + 1
 def displayEmployee(self): # function is defined here
  print "Name : ", self.name, ", Salary: ", self.salary

# "emp1 is the first object of Employee class"
emp1 = Employee("Akhil", 2000)
# "emp2 is the second object of Employee class"
emp2 = Employee("Suresh", 5000)
emp1.displayEmployee()
emp2.displayEmployee()
print "Total Employee %d" % Employee.empCount

2. Below is the Command I used to create poly.py in Ubuntu

Command to edit: 
$ vim poly.py

3. Below is the code I have written to file

Logic for Class and Object
  • Logic: In python,' init' is a mandatory method with 'self' you need to give. The arguments 'name' and 'salary' are optional to you. Here I used two objects of Employee - emp1 and emp2. The Employee is the base class. 
  • These objects used the "displayEmployee" method. According to the print definition, you got the below output details.
  • The last print has two characters. One is %d and %. The %d, pads a blank. If you want more, you can write %2d, %3d, and so on.
4. Saved the File using Below Command

  • Esc
  • :wq

5. From Python Console, get the .py module using the "import" command. It runs as and when the import completes

Execution of poly.py module in python
  • The command to import is - >>> import poly.py
  • When I imported, it displayed the messages as expected.

References

  1. Python Tricks
  2. Cool Tricks for Python Programmers

Comments

Popular posts from this blog

7 AWS Interview Questions asked in Infosys, TCS

HBASE Vs. RDBMS Top Differences You can Unlock Now

Hyperledger Fabric: 20 Real Interview Questions

How to Find Max, Min Values By Using Function

Python 'getsizeof' Command the Real Purpose