Site icon Academy for Academic Education

Python Classroom Series – 06/Jul/2021

YAML files

  • Like JSON, YAML is also collection of name value pairs
<name>: <value>
  • If the value is of primitive type (text/number/boolean) we can directly write
  • boolean in yaml can also be yes or no in addition to true/false
name: 'andy'
age: 27
online: yes
  • If the value is a list or an object. Lets see list example
courses:
  - python
  - Django
  - Flask
  - DataScience
  • if the value is object
address:
  building: Nilgiri Block
  number: 209
  landmark: Ameerpet Metro

SQLite3

  • SQLite is a software library that provides a relational dbms. The lite in SQLlite means lightweight in terms of setup, database administration and required resources
  • Download and install sqllite
  • Download sqlite studio Refer Here
  • pythons standard library for sqllite Refer Here
  • For create table query Refer Here
  • Create a products table
CREATE TABLE IF NOT EXISTS products (
        id integer PRIMARY KEY,
        name text NOT NULL,
        price real NOT NULL,
        quantity int 
)
  • Create a sales table
CREATE TABLE IF NOT EXISTS sales (
        id integer PRIMARY KEY,
        product_id integer,
        quantity integer,
        created_date text NOT NULL,
        FOREIGN KEY (product_id) REFERENCES products(id)
        
)
  • Refer Here for the sample code written to create tables from python
Exit mobile version