sqlite-bro 0.13.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sqlite_bro/__init__.py +1 -0
- sqlite_bro/sqlite_bro.py +2307 -0
- sqlite_bro/tests/__init__.py +0 -0
- sqlite_bro/tests/test_general.py +68 -0
- sqlite_bro-0.13.1.dist-info/LICENSE +21 -0
- sqlite_bro-0.13.1.dist-info/METADATA +89 -0
- sqlite_bro-0.13.1.dist-info/RECORD +9 -0
- sqlite_bro-0.13.1.dist-info/WHEEL +4 -0
- sqlite_bro-0.13.1.dist-info/entry_points.txt +3 -0
|
File without changes
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# from pyappveyordemo.extension import some_function
|
|
2
|
+
import pytest
|
|
3
|
+
import pathlib
|
|
4
|
+
import tempfile
|
|
5
|
+
|
|
6
|
+
import io
|
|
7
|
+
from sqlite_bro import sqlite_bro
|
|
8
|
+
app = sqlite_bro.App()
|
|
9
|
+
def test_DeBase():
|
|
10
|
+
"learning the ropes"
|
|
11
|
+
assert 1 == 1
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_Basics():
|
|
15
|
+
"create script, run script, output result, check result"
|
|
16
|
+
app.new_db(":memory:")
|
|
17
|
+
with tempfile.TemporaryDirectory(prefix='.tmp') as tmp_dir:
|
|
18
|
+
print(tmp_dir)
|
|
19
|
+
tmp_file = str(pathlib.PurePath(tmp_dir, 'sqlite_bro_test_Basics.tmp'))
|
|
20
|
+
welcome_text = """
|
|
21
|
+
create table item (ItemNo, Description,Kg , PRIMARY KEY (ItemNo));
|
|
22
|
+
INSERT INTO item values("T","Ford",1000);
|
|
23
|
+
INSERT INTO item select "A","Merced",1250 union all select "W","Wheel",9 ;
|
|
24
|
+
.once %s
|
|
25
|
+
select ItemNo, Description, 1000*Kg Gramm from item order by ItemNo desc;
|
|
26
|
+
.import %s in_this_table""" % (tmp_file, tmp_file)
|
|
27
|
+
app.n.new_query_tab("Welcome", welcome_text)
|
|
28
|
+
app.run_tab()
|
|
29
|
+
app.close_db
|
|
30
|
+
|
|
31
|
+
file_encoding = sqlite_bro.guess_encoding(tmp_file)[0]
|
|
32
|
+
with io.open(tmp_file, mode='rt', encoding=file_encoding) as f:
|
|
33
|
+
result = f.readlines()
|
|
34
|
+
assert len(result) == 4
|
|
35
|
+
assert result[-1] == "A,Merced,1250000\n"
|
|
36
|
+
|
|
37
|
+
def test_Outputs():
|
|
38
|
+
"testing .output, .print, .header, .separator"
|
|
39
|
+
|
|
40
|
+
app.new_db(":memory:")
|
|
41
|
+
with tempfile.TemporaryDirectory(prefix='.tmp') as tmp_dir:
|
|
42
|
+
print(tmp_dir)
|
|
43
|
+
tmp_file = str(pathlib.PurePath(tmp_dir, 'sqlite_bro_test_Output.tmp'))
|
|
44
|
+
welcome_text = """
|
|
45
|
+
create table item (ItemNo, Description , PRIMARY KEY (ItemNo));
|
|
46
|
+
INSERT INTO item values("DS","Citroën");
|
|
47
|
+
.output %s
|
|
48
|
+
.separator ;
|
|
49
|
+
.headers off
|
|
50
|
+
.print a;b
|
|
51
|
+
select * from item;
|
|
52
|
+
.headers on
|
|
53
|
+
.separator !
|
|
54
|
+
select * from item;
|
|
55
|
+
.import %s in_this_table""" % (tmp_file, tmp_file)
|
|
56
|
+
app.n.new_query_tab("Welcome", welcome_text)
|
|
57
|
+
app.run_tab()
|
|
58
|
+
app.close_db
|
|
59
|
+
|
|
60
|
+
file_encoding = sqlite_bro.guess_encoding(tmp_file)[0]
|
|
61
|
+
with io.open(tmp_file, mode='rt', encoding=file_encoding) as f:
|
|
62
|
+
result = f.readlines()
|
|
63
|
+
print(result)
|
|
64
|
+
assert len(result) == 4
|
|
65
|
+
assert result[0] == "a;b\n"
|
|
66
|
+
assert result[1] == "DS;Citroën\n"
|
|
67
|
+
assert result[2] == "ItemNo!Description\n"
|
|
68
|
+
assert result[3] == "DS!Citroën\n"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 stonebig
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: sqlite_bro
|
|
3
|
+
Version: 0.13.1
|
|
4
|
+
Summary: a graphic SQLite Client in 1 Python file
|
|
5
|
+
Keywords: sqlite,gui,ttk,sql
|
|
6
|
+
Author: stonebig
|
|
7
|
+
Requires-Python: >=3.3
|
|
8
|
+
Description-Content-Type: text/x-rst
|
|
9
|
+
Classifier: Intended Audience :: Education
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: MacOS
|
|
12
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Operating System :: POSIX
|
|
15
|
+
Classifier: Operating System :: Unix
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering
|
|
19
|
+
Classifier: Topic :: Software Development :: Widget Sets
|
|
20
|
+
Project-URL: Documentation, https://github.com/stonebig/sqlite_bro/README.rst
|
|
21
|
+
Project-URL: Source, https://github.com/stonebig/sqlite_bro
|
|
22
|
+
|
|
23
|
+
sqlite_bro : a graphic SQLite browser in 1 Python file
|
|
24
|
+
======================================================
|
|
25
|
+
|
|
26
|
+
sqlite_bro is a tool to browse SQLite databases with
|
|
27
|
+
any basic python installation.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
Features
|
|
31
|
+
--------
|
|
32
|
+
|
|
33
|
+
* Tabular browsing of a SQLite database
|
|
34
|
+
|
|
35
|
+
* Import/Export of .csv files with auto-detection
|
|
36
|
+
|
|
37
|
+
* Import/Export of .sql script
|
|
38
|
+
|
|
39
|
+
* Export of database creation .sql script
|
|
40
|
+
|
|
41
|
+
* Support of sql-embedded Python functions
|
|
42
|
+
|
|
43
|
+
* support supports command-line scripting if Python>=3.2 (see sqlite_bro -h), with or without Graphic User Interface
|
|
44
|
+
|
|
45
|
+
* Easy to distribute : 1 Python source file, Python and PyPy3 compatible
|
|
46
|
+
|
|
47
|
+
* Easy to start : just launch sqlite_bro
|
|
48
|
+
|
|
49
|
+
* Easy to learn : Welcome example, minimal interface
|
|
50
|
+
|
|
51
|
+
* Easy to teach : Character size, SQL + SQL result export on a click
|
|
52
|
+
|
|
53
|
+
Installation
|
|
54
|
+
------------
|
|
55
|
+
|
|
56
|
+
You can install, upgrade, uninstall sqlite_bro.py with these commands::
|
|
57
|
+
|
|
58
|
+
$ apt-get install python3-tk # apt-get install python-tk if you are using python2
|
|
59
|
+
$ pip install sqlite_bro
|
|
60
|
+
$ pip install --upgrade sqlite_bro
|
|
61
|
+
$ pip uninstall sqlite_bro
|
|
62
|
+
|
|
63
|
+
or just launch latest version from IPython with %load https://raw.githubusercontent.com/stonebig/sqlite_bro/master/sqlite_bro/sqlite_bro.py
|
|
64
|
+
or just copy the file 'sqlite_bro.py' to any pc and type 'python sqlite_bro.py'
|
|
65
|
+
|
|
66
|
+
Example usage
|
|
67
|
+
-------------
|
|
68
|
+
|
|
69
|
+
::
|
|
70
|
+
|
|
71
|
+
$ sqlite_bro
|
|
72
|
+
|
|
73
|
+
::
|
|
74
|
+
|
|
75
|
+
$ sqlite_bro -h
|
|
76
|
+
|
|
77
|
+
Screenshots
|
|
78
|
+
-----------
|
|
79
|
+
|
|
80
|
+
.. image:: https://raw.githubusercontent.com/stonebig/sqlite_bro/master/docs/sqlite_bro.GIF
|
|
81
|
+
|
|
82
|
+
.. image:: https://raw.githubusercontent.com/stonebig/sqlite_bro/master/docs/sqlite_bro_command_line.GIF
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
Links
|
|
86
|
+
-----
|
|
87
|
+
|
|
88
|
+
* `Fork me on GitHub <http://github.com/stonebig/sqlite_bro>`_
|
|
89
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
sqlite_bro/__init__.py,sha256=2QHyLl0eAjZVHZ_tss7n8lb71WasmiO0z0LPmToirXY,22
|
|
2
|
+
sqlite_bro/sqlite_bro.py,sha256=SnzYCYX_OBsxxwrKIvBk2q6Y0_lFG9jT4pBfAPhhkIU,99816
|
|
3
|
+
sqlite_bro/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
sqlite_bro/tests/test_general.py,sha256=NdnIFg92r-Xij1t2oApuSkiYGBltRYuzp7zubVRbN5s,2329
|
|
5
|
+
sqlite_bro-0.13.1.dist-info/entry_points.txt,sha256=zI70v9CkD9HnCo5T17H9pFY0KCXwyahkLP3LqI6c6Lc,58
|
|
6
|
+
sqlite_bro-0.13.1.dist-info/LICENSE,sha256=1jJvolOf0Vyyowi61VOQPMOj4zKuIKdmMYcXZfND_pU,1094
|
|
7
|
+
sqlite_bro-0.13.1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
|
8
|
+
sqlite_bro-0.13.1.dist-info/METADATA,sha256=2nCZ-X_4bZiGns1P8yrIB3FUrOOG5K2r1tJ-TsM4xvc,2524
|
|
9
|
+
sqlite_bro-0.13.1.dist-info/RECORD,,
|