MySQL Shell CRUD with Python: Create – with examples.

I honestly feel like MySQL hit a home run with the release of version 8. Having included so many fantastic features, it is hard to single one out above the others. However, there is one – besides Window Functions – that is really a game-changer. To be exact, the one actually makes 3 (whatever kind of sense that makes). I am talking about the MySQL Shell, the Document Store, and the X DevAPI. The focus of this post is on the Shell itself. What is it about the Shell that intrigues me? I’m sure your curiosity is piqued so keep reading to find out about the functionality you simply cannot ignore… [Keep reading for more SQL database and Python-centric content >>>]
Advertisements

Pyodbc SQL CRUD – Delete: Examples with MySQL

So far in the Pyodbc CRUD series, we’ve seen examples of how to: 1)Create new rows of data with INSERT 2)Read some data with SELECT 3)Modify existing data with UPDATE. Rounding out the CRUD operations is perhaps the most powerful command in SQL: DELETE. When it’s time for those rows of data to disappear, DELETE comes in swinging, makes it happen, and doesn’t look back. It’s been said uncountable times before, but, it is always worth repeating; DELETE completely removes data. Enough with the antics, let’s see it in action using pyodbc…

[Keep reading for more SQL database and Python-centric content >>>]

Pyodbc SQL CRUD – Update: Examples with MySQL

Likely, some of the data you store will remain unchanged. Yet, the majority of it changes rapidly depending on its nature and the purpose it serves. How do you modify data already present in your tables? We know that to CREATE new rows of data in a table, we employ INSERT, and to see the data on hand, SELECT is there. However, to change it, that is the job of the UPDATE command. Keep reading to see a couple of simple examples using the pyodbc Python driver…

[Keep reading for more SQL database and Python-centric content >>>]

SQL to JSON using the JSON_OBJECT() function in MySQL – with examples.

I have begun exploring JSON, the MySQL X Dev API, and the Document Store in earnest due to a requirement I am facing in my day job. The data model I am working with presents several challenges (don’t they all). Inspired in my own right by 2 fantastic books I am currently reading and working through: SQL Antipatterns: Avoiding the Pitfalls of Database Programming by Bill Karwin and Introducing MySQL Shell by Charles Bell. I am starting to see that JSON, the MySQL X Dev API, and the Document Store just might be my salvation. Based on my understanding gained from both books – for differing reasons – I have come to this conclusion. Both books have influenced my thinking in terms of different options, applicable to my particular data needs. In this post, I will go from SQL to JSON all within MySQL using built-in functionality….

[Keep reading for more SQL database and Python-centric content >>>]

Pyodbc SQL CRUD – Read: Examples with MySQL

Reading the data in a database table is a fundamental SQL operation. I suppose you could just store the data and be done with it. But, where is the fun in that? To see stored data, you use the SELECT command. In the CRUD acronym, that is the Read aspect. I have written extensively on SQL CRUD operations in the past (see list of posts at the end of this piece). But, how do you read rows of data with pyodbc as the middleware (termed loosely here) between you and the database? Keep reading to see several simple examples…

[Keep reading for more SQL database and Python-centric content >>>]