Member-only story

Column meta-data in MySQL Shell with Python mode

Josh Otwell
6 min readMay 27, 2020

--

Meta-data is important to SQL DBA’s and Developers, likely for different reasons. There are all sorts of ways to access meta-data. The powerful MySQL Shell in Python mode is no exception. What if you need the column meta-data on a result set? You can use the get_columns() method and obtain useful meta-data information about it (the result set). All in Python mode. Continue reading to see examples…

Photo by Adrian Trinkaus on Unsplash

OS and DB used:

  • OpenSuse Leap 15.1
  • MySQL 8.0.20

Self-Promotion:

If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like!

I’ll retrieve a listing of all the tables in the Sakila Sample Database I have installed on my local MySQL instance, by calling the get_tables() method on the db object:

MySQL localhost:33060+ ssl sakila Py > db.get_tables()
[
<table:actor>,
<table:address>,
<table:category>,
<table:city>,
<table:country>,
<table:customer>,
<table:film>,
<table:film_actor>,
<table:film_category>,
<table:film_text>,
<table:inventory>,
<table:language>,
<table:payment>,
<table:rental>,
<table:staff>,
<table:store>,
<table:actor_info>…

--

--

Josh Otwell
Josh Otwell

Written by Josh Otwell

SQL/PHP | Photography | Technical Consultant. Sign-up for my free developer newsletter, OpenLampTech, here: openlamptech.substack.com

No responses yet