3594 views|6 replies

1w

Posts

25

Resources
The OP
 

μSQLite module for MicroPython [Copy link]

 

usqlite is a SQL database module for MicroPython built on top of the SQLite C library

. The usqlite SQL interface is designed as a subset of the DB-API 2.0 specification specified in PEP 249.

It is highly compatible with standard sqlite3 and has some additional features. Using the usqlite module is relatively simple. Import the usqlite module, connect to the database, and then execute SQL commands. For example:

import usqlite

if not usqlite.mem_status():
    usqlite.mem_status(True) # Enable memory status monitoring

con = usqlite.connect("data.db")

con.executemany(
    "BEGIN TRANSACTION;"
    "CREATE TABLE IF NOT EXISTS data (name TEXT, year INT);"+
    "INSERT INTO data VALUES ('Larry', 1902);"+
    "INSERT INTO data VALUES ('Cury', 1903);"+
    "INSERT INTO data VALUES ('Moe', 1897);"+
    "COMMIT;")

with con.execute("SELECT * from data") as cur:
    for row in cur:
        print("stooge:", row)
        
con.close()

print("usqlite mem - current:", usqlite.mem_current(), "peak:", usqlite.mem_peak())

游客,如果您要查看本帖隐藏内容请回复

Latest reply

How to compile this into the firmware? It has not been compiled successfully.   Details Published on 2023-9-5 15:52
 
 

2w

Posts

341

Resources
2
 

Need a reply? See below

 
 
 

685

Posts

0

Resources
3
 

To see how the performance is

 
 
 

7422

Posts

2

Resources
4
 

String '+' operation spelling SQL

Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 
 

7

Posts

0

Resources
5
 
There is indeed such a demand. The original SQLITE is too large. But if the project is written in C, it is too troublesome to compile the firmware yourself. I have been stuck in the network problem for a long time and cannot download the IDF package (ESP32))
 
 
 

17

Posts

0

Resources
6
 
See how the performance is
 
 
 

1

Posts

0

Resources
7
 

How to compile this into the firmware? It has not been compiled successfully.

 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list