Skip to content

Commit c069827

Browse files
authored
Merge pull request #2 from SyntaxAerror/sqlite-db
sqlite-db
2 parents 93258cd + d7daf05 commit c069827

File tree

12 files changed

+757
-21
lines changed

12 files changed

+757
-21
lines changed

.flake8

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
[flake8]
2-
ignore = E261
2+
# Notes:
3+
# W503: https://peps.python.org/pep-0008/#should-a-line-break-before-or-after-a-binary-operator
4+
ignore = E261, W293, W503
35
max-line-length = 200
46
exclude = .git,.github,__pycache__,.pytest_cache,.venv,.venv_test,.vscode
57
max-complexity = 10

.github/workflows/python-package.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@ jobs:
3232
- name: Lint with flake8
3333
run: |
3434
# stop the build if there are Python syntax errors or undefined names
35-
flake8 . --count --select=E9,F63,F7,F82 --ignore=E261 --show-source --statistics
35+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
3636
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
3737
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
38+
- name: Install stat-log-db package (dev)
39+
run: |
40+
python -m pip install -e ./stat_log_db[dev]
3841
- name: Test with pytest
3942
run: |
4043
pytest

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,6 @@ cython_debug/
206206
marimo/_static/
207207
marimo/_lsp/
208208
__marimo__/
209+
210+
# sqlite
211+
*.sqlite

stat_log_db/pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ name = "stat-log-db"
77
version = "0.0.1"
88
description = ""
99
readme = "README.md"
10-
requires-python = "==3.12.10"
10+
requires-python = ">=3.12.10"
1111
dependencies = [
1212
]
1313

1414
[project.optional-dependencies]
1515
dev = [
1616
"pytest==8.4.1",
17-
"pytest-cov==6.2.1"
17+
"pytest-cov==6.2.1",
18+
"flake8==7.3.0"
1819
]
1920

2021
[project.scripts]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
from . import exceptions
22
from . import parser
3+
from . import db
34
from . import cli

stat_log_db/src/stat_log_db/cli.py

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
11
import os
2-
import sys
2+
# import sys
33

4-
from .parser import create_parser
4+
# from .parser import create_parser
5+
from .db import MemDB # , FileDB, Database, BaseConnection
56

67

78
def main():
89
"""Main CLI entry point."""
910

1011
# TODO: Read info from pyproject.toml?
11-
parser = create_parser({
12-
"prog": "sldb",
13-
"description": "My CLI tool",
14-
}, "0.0.1")
15-
16-
args = parser.parse_args()
17-
18-
print(f"{args=}")
12+
# parser = create_parser({
13+
# "prog": "sldb",
14+
# "description": "My CLI tool",
15+
# }, "0.0.1")
16+
17+
# args = parser.parse_args()
18+
19+
# print(f"{args=}")
20+
21+
sl_db = MemDB({
22+
"is_mem": True,
23+
"fkey_constraint": True
24+
})
25+
con = sl_db.init_db(True)
26+
con.create_table("test", [('notes', 'TEXT')], False, True)
27+
con.execute("INSERT INTO test (notes) VALUES (?);", ("Hello world!",))
28+
con.commit()
29+
con.execute("SELECT * FROM test;")
30+
sql_logs = con.fetchall()
31+
print(sql_logs)
32+
con.drop_table("test", True)
33+
sl_db.close_db()
34+
if sl_db.is_file:
35+
os.remove(sl_db.file_name)
1936

2037

2138
if __name__ == "__main__":

0 commit comments

Comments
 (0)