Anda di halaman 1dari 4

Date:

Data:countable n meaningfull
Data is a collection of countable n meaningfull things
eg:students data,products data n employee's data

Database: Database (DB) are organized, they have a structure,


and all the data they store it fits into that structure.
->collection of data-is uesd for arrangment-it is done for 2
reasons
1.fast
2.accuracy
Data base is an arrangment of data for fast n accuracy
Eg;Spread sheets,books or manual books-(physical books)

DBMS:It is a software called as database managment system


****To create, manage,privacy(not observed/disturbed by other people-eg:ATM),
security(safety external),
protection(safety internally),sharing(common),backup(copy of original data),
distribution(partiton),recovery(of backup data),roles(designation),
authentication(means id's or credentials/username n passowrds-individual thing),
authorization(permissions-given to authenticated people) etc.

Which is not possible through our spread sheets n manual book managment

SQLITE 3-ORM(object relation mapper)-it is used at development site

******.db file in our phone-in this file all data is stored


if we delete that file our data
import ur chat as email

Database system:
Database+DBMS is called as database system
The following are DBMS softwares
1.Oracle
2.SQL server
3.MYSQL
4.Postgruess
5.MongoDB
6.SQLALCHAEMY
7.XML etc.

In python the built in DBMS softaware is as a module ****"SQLITE 3 "-it's


supports mygration form different DBMSS(many dbms)
It's supports ORM model
where data is stored n managed using objects in realtions/tables

******SQLITE 3 supports mainly in production side as well as development side


*****SQLITE 3 in python works through 2 modes
1.File mode:
The Database can be stored along with data as a file with an extension as
".db"
2.In Memory mode:
Whenever we want to work in production time the temporary data or values
will be run n stored within memory but not as a physicl stored file

In Memory is efficient than file mode at the time of production


*****CURSOR:
In python we use cursors to store n retrive data from database
To work with SQLITE 3 or any database we need to follow following steps:
1.open connection with the database
2.create a cursor
3.Query on the data base
4.pass the query to cursor
5.execute the cursor
6.returns the results accordingly
7.close the connection

In python query's are called commands


we can use DDL,DML,DQL commands

DDL:(data definition language)


Create ,alter ,drop,truncate
DMl:(data manipulation language)
Insert(all values),delete,update(specific)
DQl(data query lang):select
we can aslo excute scripts of dbms,like procedures
functions,triggers,cursors(this are part of dbms)

we can use context manager to work with database connections

OPPS:(Object Oriented Programming Synopsis)


object based is differnt from object oriented
eg:javascript is an object based but java is an object oriented

The following are the main features


1.Abstraction:
Abstration is a collection of ****states n behaviours
*states are varaiables ,behaviours are methods
*In python class is a abstraction of varaibles n methods
*Abstraction is also hiding the details from outside code(eg:BankAccount)

functions-individual work
method:

Eg: a=10
b=20
def add(a,b)
return a+b
print(add(a,b))
print(a)

In order to work with class varaiables n methods we need an object


Object is an working model of a class i.e its supports variables,methods related
to the class

Eg:
a=10
b=20

object is a variable for a class like 'a' and 'b'


In python the variables are named as attributes
Constructor or init method:
def __init__(self,args): ----they are called as dunder methods
init method is used to initialize the values related to the attributes
self:In python we can access the attributes n methods using self variable/object
within the class

For every method we need to pass the first argument as self


EG:
class BankAccount():
def __init__(self,acno,acname,bal): #method because it has a first arugument
as self n acno,name,bal are attributes
self.acno=acno # inint method works only one time,init method
works only at the objects creation
self.acname=acname
self.bal=bal
def withdraw(self,amt):
self.bal-=amt
def deposit(self,amt):
self.bal+=amt #3 methods,init,withdraw,deposit

#class name-bankaccount
#acno,acname,bal-attributes

Creation of object in python:

sbi=BankAccount(123,'mm',0)
hdfc=BankAccount(234,'fugusg',5)-of() calls a constructor(init method)
icici=BankAccount(214,'fugusg',5)

*****some times the init method may not consists any arrguments / attributes
i.e init method is an optional

2.Encapsulation:It is providing permissions over states n behaviours


or wrap around states n behaviours
In python we have static permission-it provide security through encapsulation
it's a sheilding(internal )-protection
It is used to provide permissions over variables n methods

3.Inheritance:It is property to create reusable components-we can use to create


relationship between two or more parent abstractions
Inheritance is a concept to create an child class from an
exsisting parent class
*****python supports multiple inheritance

EG:
class InternetBanking(BankAccount):
def __init__(self,args):
super()
self.args=args
def huuhsn():
j

class MB(BA,IB) #multipl inheritance

Here super()-is used to refer parent class,super class,base class are same
similarly -is used to refer child,sub,derived

4.polymorphism:Adding extra behaviours to the already exsisting component is


known as polymorphism
In python polymorphism is done through
1.overloading-having the same name but differ in no of arrguments n differnt
return types
NOTE:Overloading exists within the class whereas override is exits between parent
and child classes

NOTE:Inheritance will create copy paste kind of behaviours


whereas polymorphic approach will create dynamic feature to change its exsisting
parents behaviour with child's implementation

work on csv n json


databse,re,os

ASSIGNMENT:
read the data from the keyboard n pass to a insert statement
use interpreter

SQLITE 3 datatypes -int,real,blog(binary large objects),null(none)

tommorrow's important topic:


sql injection- using formatted strings
how to insert date ,time
****two way authentication of email id-see in google

Anda mungkin juga menyukai