-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtest_baresql.html
More file actions
35 lines (31 loc) · 1.14 KB
/
test_baresql.html
File metadata and controls
35 lines (31 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<html>
<head>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@holoviz/panel@0.14.2/dist/panel.min.js"></script>
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
</head>
<body>
<py-config>
packages = [
"baresql"
]
</py-config>
<h1>baresql Example</h1>
<div id="Test baresql"></div>
<div>
<py-terminal>
</div>
<py-script>
# was ok with https://pyscript.net/2022.12.1/pyscript.js
# you can try last official release: https://pyscript.net/latest/pyscript.js and css
# or current unstable master: https://pyscript.net/unstable/pyscript.js and cssfrom __future__ import print_function, unicode_literals, division # if Python2.7
from baresql import baresql
bsql = baresql.baresql(keep_log = True )
bsqldf = lambda q: bsql.df(q, dict(globals(),**locals()))
users = ['Alexander', 'Bernard', 'Charly', 'Danielle', 'Esmeralda', 'Franz']
# We use the python 'users' list like a SQL table
sql = "select 'Welcome ! ' , c0 from users$$"
print(bsqldf(sql))
</py-script>
</body>
</html>