MySQL Shell get_auto_increment_value() method – Python mode

These days, I mostly program in PHP with MySQL as the database, which is just fine by me. I have had a long-time interest in MySQL (SQL in general), and after several steady months of programming in PHP, I must say I have really come into the language and developed a fondness for it. All that being said, I still enjoy using and learning the MySQL Shell in Python mode. As Database Developers, we often need the LAST INSERT ID value from a previous INSERT statement on a column that has the AUTO_INCREMENT attribute. MySQL Shell has a get_auto_increment_value() method we can call against a Shell object result and retrieve that value. Continue reading and see examples of the MySQL Shell get_auto_increment_value() method used in Python mode…

[Keep reading for more MySQL database and Python/PHP-centric content >>>]

Basic Data Analysis with MySQL Shell Python mode

I recently watched a fantastic Python Pandas library tutorial series on YouTube. Without a doubt, Pandas is great for all sorts of data stuff. On the same token, MySQL Shell in Python mode is quite powerful in the sense that Python and the MySQL Shell (version >= 8.0) are somewhat united in the same environment. Although Pandas is in a league all its own when it comes to data analysis, between the power of MySQL and Python, we can also perform some basic analysis easily in MySQL Shell Python mode. In this blog post, I will cover some basic data analysis using Python mode in the MySQL Shell. Continue reading to see examples…

[Keep reading for more MySQL database and Python/PHP-centric content >>>]

MySQL Shell Python mode blog posts compilation

Over the last few months, I have written numerous blog posts on different features of the MySQL Shell ranging from basic CRUD to aggregate functions and DDL. As a part of the MySQL version 8 release, MySQL Shell is a powerful and alternative environment that you can manage and work with your data in using a choice of 3 languages: Python, Javascript, or SQL. So this blog post is a simple compilation of all the Python mode related posts, in one easy-to-access location…

[Keep reading for more MySQL database and Python/PHP-centric content >>>]

Dynamic MySQL CREATE TABLE statement with pandas and pyodbc

Have you ever had to type out a massive CREATE TABLE statement by hand? One with dozens of columns? Maybe several dozens of columns? There are likely some GUI tools to help with large CREATE TABLE commands. Or, other drag-n-drop types of software that I am not familiar with. What if you could write a few lines of Python code and take care of a huge CREATE TABLE statement with way less effort than typed manually? Interested? Continue reading and see how using pandas, pyodbc, and MySQL…

[Keep reading for more MySQL database and Python/PHP-centric content >>>]

Exploring .count() and COUNT() – MySQL Shell Python mode

Retrieving a table count of rows using the COUNT(*) aggregate function in MySQL is a straight-forward query. What if I told you that with the MySQL Shell, there are actually 3 possible ways – between 2 Shell modes (\sql and \py) – to retrieve a table row count? Would you be interested in knowing about them? Honestly, one of the queries will not surprise you in the least bit, as you are likely already using it. However, the other 2 queries – in this context – are specific to MySQL Shell Python mode. You can likely execute these queries in Javascript Mode. However, I am not versed in Javascript programming nor MySQL Shell Javascript mode so those queries are not covered here. Continue reading to see the example queries in Python mode…

[Keep reading for more MySQL database and Python/PHP-centric content >>>]