Another post starts with you beautiful people! Hope you have enjoyed and learn from my previous post about Relational Database In Python-sqlite Previously, we used the Table object to reflect a table from an existing database , but what if you wanted to create a new table? We'd still use the Table object; however, we'd need to replace the autoload and autoload_with parameters with Column objects . The Column object takes a name, a SQLAlchemy type with an optional format, and optional keyword arguments for different constraints. After defining the table, we can create the table in the database by using the .create_all() method on metadata and supplying the engine as the only parameter. You can find more details about metadata here- tell me more about metadata! Output:- Well done! When creating a table, it's important to carefully think about what data types each column should be. Constraints and Data Defaults- We're now going to practice creating a t...
This blog is dedicated to all aspiring data scientists. I will share my learning about Data Science, Machine Learning, Deep Learning, OCR, and Computer Vision with my blog posts. So keep reading my posts and be a better version of yourself. Contact me for any AI-related freelance or consultancy work.