Python Forum
SQLAlchemy - Program Name in SQL Workbench - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: SQLAlchemy - Program Name in SQL Workbench (/thread-24098.html)



SQLAlchemy - Program Name in SQL Workbench - jim2007 - Jan-30-2020

Very new to Python, but older that I'd care to admit to programming ;-)

So I have been working with SQLAlchemy for the past few days and all has been going well except for one little issue.. When I look at the client connections tab in the MySQL Workbench, the program name is: None.

Anyone know what I need to change so my program name appears in the list?

Thanks.


RE: SQLAlchemy - Program Name in SQL Workbench - Larz60+ - Jan-31-2020

There needs to be a tutorial on this forum about SqlAlchemy,
completely self contained that starts with data collection, creating a database model, and running a session to load the collected data into that database. You have inspired me to create one, it's started, and will be ready soon. I'll let you know when complete.


RE: SQLAlchemy - Program Name in SQL Workbench - Larz60+ - Feb-01-2020

I added a tutorial, but it's pretty basic, and won't answer your question.
To answer your question. It would be most helpful if you could post code (if still dealing with this issue)
See: https://python-forum.io/Thread-SqlAlchemy-Basic-Model-database-Creation-and-Data-Load


RE: SQLAlchemy - Program Name in SQL Workbench - jim2007 - Feb-02-2020

It is not a coding issue. As far as I can see it a feature deficit in SQLAlchemy. There just is no way to indicate to MySQL the name of program owning the connection. This becomes a support issue because the DBA has no way of knowing which of the users 5 or 6 connections is related to the user’s application. They all appear in the console with the name ‘None’.

Will eventually have to sit down and figure out a workaround, but for now I will park it. Thanks.


RE: SQLAlchemy - Program Name in SQL Workbench - Larz60+ - Feb-02-2020

You can use the database itself, by creating a user table and requiring user login for access to the database, Same as you would do for a web application. There's a complete procedure on how to do this in Miguel Grinberg's flask tutorial, which with a few changes can be adapted for both web access and non-web access.

Specifically chapters 4 and chapter 5. Would something like liks be sufficient?

SqlAlchemy suggests such a system here as well (I haven't read this entirely, but enough to see that it involves a user table as well).