uPyMySQL

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
User avatar
rdagger
Posts: 143
Joined: Tue Feb 28, 2017 6:16 pm
Contact:

Re: uPyMySQL

Post by rdagger » Sun Mar 03, 2019 7:57 am

dvrhax wrote:
Sat Mar 02, 2019 2:44 am
I've only recently picked this back up and I'm really only using it for logging functionality so basic inserts myself. I have gone back and shrunk the size considerably and also worked through some more kinks including some with regards to "errno" so If you do pick up the project again make sure to use the updated code.
Good luck
Thanks. The ability to log sensor data to an external server is very handy. I will take another look at it. Did you get the DateTime fields working?

dvrhax
Posts: 16
Joined: Fri Jul 07, 2017 11:13 pm

Re: uPyMySQL

Post by dvrhax » Fri Mar 08, 2019 10:58 pm

The datetime stuff is a bit of a kludge so you'd probably have to see how it fit within your use case. I generally set up the table with a timestamp field that way I don't have to worry about it on the board. Plus my boards don't have RTC so it's easiest just not to have to deal with it.

Code: Select all

create table Doors ( id int NOT NULL AUTO_INCREMENT,
						recorded DATETIME DEFAULT CURRENT_TIMESTAMP,
                        			door CHAR(5) NOT NULL,
                        			state TINYINT(1) NOT NULL,
                        			PRIMARY KEY (id)
                        			);
In fact that was a big reason I went with MySQL a) the server is done and b) the timestamping.

Good luck. Let me know if you find any bugs.

Post Reply