Coder Social home page Coder Social logo

hanenia / datafun-05-sql Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 121.58 MB

Python 88.84% Shell 0.01% C 1.08% Cython 2.53% C++ 6.46% Batchfile 0.01% HTML 0.11% CSS 0.77% JavaScript 0.10% Makefile 0.01% Meson 0.01% Fortran 0.04% Forth 0.01% Smarty 0.01% CMake 0.01% Roff 0.01% VBScript 0.01% XSLT 0.01% Classic ASP 0.01% PowerShell 0.03%

datafun-05-sql's Introduction

Overview integrates Python and SQL, focusing on database interactions using SQLite, introduction to logging, varoius SQL opertions.

Project Start

  1. Create GitHub repository ( README.md)

  2. Clone the repostory to your machine.

  3. Creat and avtivate a Python virtal eniroment

  4. Add a .gitignore file

  5. Creat and avtivate a Python virtal eniroment and freeze into your requirements.txt. ..venv\Scripts\Activate.ps1 py -m pip install pandas pyarrow py -m pip freeze > requirements.txt

  6. push to GitHub. git add . git commit -m "initial commit" git push origin main

  7. Create docstring vcr_manager.py

  8. Import Dependencies import sqlite3 import pandas as pd import pathlib

  9. Logging: Implement logging to enhance debugging and maintain a record of program execution.

  10. Desgin and Database Creation import sqlite3 def execute_sql_from_file(db_filepath, sql_file): with sqlite3.connect(db_filepath) as conn: with open(sql_file, 'r') as file: sql_script = file.read() conn.executescript(sql_script) print(f"Executed SQL from {sql_file}"

  11. SQL Operations def main(): db_filepath = 'your_database.db'

    Create database schema and populate with data

    execute_sql_from_file(db_filepath, 'insert_records.sql') execute_sql_from_file(db_filepath, 'update_records.sql') execute_sql_from_file(db_filepath, 'delete_records.sql') execute_sql_from_file(db_filepath, 'query_aggregation.sql') execute_sql_from_file(db_filepath, 'query_filter.sql') execute_sql_from_file(db_filepath, 'query_sorting.sql') execute_sql_from_file(db_filepath, 'query_group_by.sql') execute_sql_from_file(db_filepath, 'query_join.sql')

    logging.info("All SQL operations completed successfully")

datafun-05-sql's People

Contributors

hanenia avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.