Friday, April 6, 2018

Interaction Between database and python

Many people were aware of java rather than python. Why? The reason is the lack of awareness of that programming language and people were ready to write lines and lines of code to write execute a simple program and there were some situations like while developing a new project, there is need to change the variable type at a particular instance where the developer needs to change the variable type declaration in the source code.
If the end user needs to change to the other type, the user must approach the developer for the change of variable type. Does java fail in the situation, where the data type of the end user input variable is unknown? This problem overcame by the python.  And many people don’t know that python is an older language than java. Today in this article we were going to discuss  How does python interact with databases?
Before going how do those interact,  let’s have an overview of what is python?
Python is an object-oriented, high-level and interactive programming language which was made by Guido van Rossum amid the year 1985 – 1990. The source code of python is accessible under GNU Global Public License (GPL). Today we’re listening like, a particular programming language is object-oriented and supports OOPS feature. what are those OOPS standards?
Get more information on python from OnlineITGuru through Python Online Training Bangalore.
OOP’s stand for object-oriented programming structure where it follows certain standards(features) which were common and where ever these concept is applicable in a programming language.  The programming language is said to support oops concept whenever it supports the following features.
Inheritance:   Acquiring the properties of a superclass by a subclass is called Inheritance
python online course hyderabadEncapsulation:  Wrapping up of code and data in a single class is called Encapsulation
python online training from bangaloreAbstraction: Hiding of the original  data
Polymorphism: Existing in many forms. i.e a superclass may be divided into multiple subclasses.
Today we were getting the information from various sources. This information must be stored in an easy secure way so as to retrieve the data whenever required.  Today we have many databases for storing and retrieval of data. Among them, MYSQL  provided by ORACLE  has its own importance. It has been used by many companies for storing and retrieval of data. Now let us have a look at  How does  Python interact with databases like MySQL.
MySQL DB is an interface for connecting  MySQL database server from python. Before connecting the programming language to the MYSQL DB make sure that the  MQSQL Db is been installed on your system. If the connection is established with your database source, the connection object is returned and saved in DB for future use, otherwise, the DB is set to none.  Next, DB object is used to create cursor which in turn is used to run  SQL queries. Finally, it ensures that database connection is closed and the resources were released.
After creation the connection with the database, the next step is to creating the table in the database and then inserting the data in the database, where INSERT ();  is used for inserting the data in the database.  After Insertion of data, there is a need for retrieval of data where do the  Read ();  is used for the retrieval of data.   Fetching  of data from the database is divided into three  categories :
           Fetch One(): It is used for fetching the single row (next row ) of data from the query result set.  A result set is an object that is returned when a cursor object is used to query a table.
           Fetch all (): This function is used to fetch all the records of the table in the result set.   If some results have been already retrieved then the remaining results will be fetched.
           Row Count (): It is used to count the number of rows from the result set.
Along with the above operations, it also performs the updating of records and deletion of duplicate (or) unnecessary records from the database.Using this database as a means for storing the data, python serves as a  basis for coding many programmers today.
Become a Master of python from OnlineITguru through Python online training.

Major difference between Python 2 & 3

Today we will examine Major Difference Between Python 2 and 3 and why a few endeavors are moving from Python 2 to 3? what's more, a tad...