(Feb-20-2017, 06:49 PM)Larz60+ Wrote: I can't run this as I don't use MySql, but I think
changing:
cls.__instance = super(MysqlPython, cls).__new__(cls, *args, **kwargs)to:
cls.__instance = super(MysqlPython, self).__new__(cls, *args, **kwargs)may be the issue
I tried this change and now I get
Error:/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 "/Users/jasonstockton/Qt programs/Demo/DemoQMLProgram/main.py"
getMonitorInterval
Traceback (most recent call last):
File "/Users/jasonstockton/Qt programs/Demo/DemoQMLProgram/main.py", line 287, in <module>
QObject,main(sys.argv)
File "/Users/jasonstockton/Qt programs/Demo/DemoQMLProgram/main.py", line 259, in main
app = Controller(sys.argv)
File "/Users/jasonstockton/Qt programs/Demo/DemoQMLProgram/main.py", line 244, in __init__
environment = Environment()
File "/Users/jasonstockton/Qt programs/Demo/DemoQMLProgram/main.py", line 34, in __init__
self.interval = AppSettings.getmonitorinterval(self)
File "/Users/jasonstockton/Qt programs/Demo/DemoQMLProgram/main.py", line 78, in getmonitorinterval
_connection = MysqlPython('raspi', 'root', 'pwd', 'Demo')
File "/Users/jasonstockton/Qt programs/Demo/DemoQMLProgram/main.py", line 101, in __new__
cls.__instance = super(MysqlPython, self).__new__(cls, *args, **kwargs)
NameError: name 'self' is not defined
Process finished with exit code 1
Are the errors I am getting occurring because of MySQL or are they straight Python errors? I was thinking the errors are coming from Python and would occur no matter what flavor of SQL I use.(Feb-20-2017, 08:28 PM)Larz60+ Wrote: It is a straight forward procedure in any relational database management system that I have worked with to unload a complete schema to external files.
I don't know how to do this in MySQL, here's how it's done in sqlite3, MySql will have some sort of dump program
The database is one of mine:
sqlite3 StockMktDb sqlite> sqlite> .output StockMktDb.sql sqlite> .dump sqlite> .quitpartial results:
However, that aside, once a database has been dumped to .sql files, it's
Output:PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; CREATE TABLE ASXListed ( CompanyName VARCHAR, AsxSymbol VARCHAR, GicsIndustryGroup VARCHAR); INSERT INTO "ASXListed" VALUES('Company name','ASX code','GICS industry group'); INSERT INTO "ASXListed" VALUES('MOQ LIMITED','MOQ','Software & Services'); INSERT INTO "ASXListed" VALUES('1-PAGE LIMITED','1PG','Software & Services'); INSERT INTO "ASXListed" VALUES('1300 SMILES LIMITED','ONT','Health Care Equipment & Services'); INSERT INTO "ASXListed" VALUES('1ST AVAILABLE LTD','1ST','Health Care Equipment & Services'); INSERT INTO "ASXListed" VALUES('333D LIMITED','T3D','Food, Beverage & Tobacco');
a simple procedure to reload in sqlite3.
sqlite3 newdb sqlite> .read StockMktDb.sqlThat's all there is to it
I think I figured out how I can make SQLite work. As I've been trying to develop this app I've run into various issues and have gone down different paths that work or don't work and I had a thought in my head that wasn't accurate. Talking through all of this made me look at it differently and realize this is a derp moment for me. My QML is calling a Python slot to interact with the db which I was going to do with MySQL. I just realized I can use SQLite in the slot instead. I'll set the db name in Python and not worry about having to set it in QML. I would still like to figure out why my SQL class above is throwing that error.