Update sqlite3-python/README.md
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
# Simple SQL
|
# Simple SQL
|
||||||
```python
|
```python
|
||||||
def SQL(db='sql.db', *, sqlite3=__import__('sqlite3'), pd=__import__('pandas')):
|
def SQL(db='sql.db', *, sqlite3=__import__('sqlite3')):
|
||||||
con = sqlite3.connect(db, isolation_level=None, timeout=1e999)
|
con = sqlite3.connect(db, isolation_level=None, timeout=999)
|
||||||
con.execute('PRAGMA journal_mode=WAL'); con.row_factory = sqlite3.Row
|
con.execute('PRAGMA journal_mode = WAL'); con.row_factory = sqlite3.Row
|
||||||
return lambda sql, *params: pd.DataFrame(map(dict, con.execute(sql, params)))
|
return lambda q, *p: list(map(dict, con.execute(q, p)))
|
||||||
sql = SQL()
|
sql = SQL()
|
||||||
sql('SELECT * FROM sqlite_master WHERE type="table"')
|
sql("SELECT * FROM sqlite_master WHERE type = 'table'")
|
||||||
```
|
```
|
||||||
|
|
||||||
# Dict-like
|
# Dict-like
|
||||||
|
|||||||
Reference in New Issue
Block a user