Skip to content

Commit 25ae065

Browse files
Merge pull request #4 from sqlitecloud/#3-remove-C-dependency
#3 remove c dependency
2 parents 72fc921 + 36c8ce6 commit 25ae065

27 files changed

Lines changed: 1948 additions & 1476 deletions

.devcontainer/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM mcr.microsoft.com/devcontainers/python:3.6-bullseye
2+
3+
ADD https://dl.yarnpkg.com/debian/pubkey.gpg /etc/apt/trusted.gpg.d/yarn.asc
4+
5+
RUN chmod +r /etc/apt/trusted.gpg.d/*.asc && \
6+
echo "deb http://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list

.devcontainer/devcontainer.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/python
3+
{
4+
"name": "Python 3",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"build": {
7+
"dockerfile": "Dockerfile"
8+
},
9+
"features": {
10+
"ghcr.io/warrenbuckley/codespace-features/sqlite:1": {}
11+
},
12+
13+
// Features to add to the dev container. More info: https://containers.dev/features.
14+
// "features": {},
15+
16+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
17+
// "forwardPorts": [],
18+
19+
// Use 'postCreateCommand' to run commands after the container is created.
20+
// "postCreateCommand": "pip3 install --user -r requirements.txt",
21+
22+
// Configure tool-specific properties.
23+
"customizations": {
24+
"vscode": {
25+
"extensions": [
26+
"littlefoxteam.vscode-python-test-adapter",
27+
"jkillian.custom-local-formatters"
28+
]
29+
}
30+
}
31+
32+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
33+
// "remoteUser": "root"
34+
}

.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
SQLITE_CONNECTION_STRING=sqlitecloud://myhost.sqlite.cloud
2+
SQLITE_USER=admin
3+
SQLITE_PASSWORD=
4+
SQLITE_API_KEY=
5+
SQLITE_HOST=myhost.sqlite.cloud
6+
SQLITE_DB=chinook.sqlite
7+
SQLITE_PORT=8860

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for more information:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
# https://containers.dev/guide/dependabot
6+
7+
version: 2
8+
updates:
9+
- package-ecosystem: "devcontainers"
10+
directory: "/"
11+
schedule:
12+
interval: weekly

.pylintrc

Lines changed: 0 additions & 5 deletions
This file was deleted.

Makefile

Lines changed: 0 additions & 23 deletions
This file was deleted.

requirements-dev.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
pylint==2.15.6
2-
pytest==7.1.2
3-
mypy==1.6.1
4-
mypy-extensions==1.0.0
5-
typing-extensions==4.8.0
1+
pylint==2.13.9
2+
mypy==0.971
3+
typing-extensions==4.1.1
64
bump2version==1.0.1
7-
pytest-mock==3.10.0
8-
black==23.7.0
9-
python-dotenv==1.0.0
5+
pytest==7.0.1
6+
pytest-mock==3.6.1
7+
black==22.8.0
8+
python-dotenv==0.20.0
9+
lz4==3.1.10

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lz4==3.1.10

samples.ipynb

Lines changed: 27 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,17 @@
1313
},
1414
{
1515
"cell_type": "code",
16-
"execution_count": 1,
16+
"execution_count": 8,
1717
"metadata": {},
18-
"outputs": [
19-
{
20-
"name": "stdout",
21-
"output_type": "stream",
22-
"text": [
23-
"Loading SQLITECLOUD lib from: /Users/sam/projects/codermine/sqlitecloud-sdk/C/libsqcloud.so\n"
24-
]
25-
}
26-
],
18+
"outputs": [],
2719
"source": [
28-
"from sqlitecloud.conn_info import user,password,host,db_name,port\n",
29-
"from sqlitecloud.client import SqliteCloudClient, SqliteCloudAccount"
20+
"import sys\n",
21+
"\n",
22+
"sys.path.append('/workspaces/python/src')\n",
23+
"\n",
24+
"from sqlitecloud.conn_info import user, password, host, db_name, port\n",
25+
"from sqlitecloud.client import SqliteCloudClient\n",
26+
"from sqlitecloud.types import SqliteCloudAccount"
3027
]
3128
},
3229
{
@@ -40,27 +37,27 @@
4037
},
4138
{
4239
"cell_type": "code",
43-
"execution_count": 2,
40+
"execution_count": 9,
4441
"metadata": {},
4542
"outputs": [],
4643
"source": [
47-
"account = SqliteCloudAccount(user, password, host, db_name, port)\n",
44+
"account = SqliteCloudAccount(user, password, host, db_name, int(port))\n",
4845
"client = SqliteCloudClient(cloud_account=account)\n",
4946
"conn = client.open_connection()"
5047
]
5148
},
5249
{
5350
"cell_type": "code",
54-
"execution_count": 3,
51+
"execution_count": 10,
5552
"metadata": {},
5653
"outputs": [
5754
{
5855
"data": {
5956
"text/plain": [
60-
"'people'"
57+
"'chinook.sqlite'"
6158
]
6259
},
63-
"execution_count": 3,
60+
"execution_count": 10,
6461
"metadata": {},
6562
"output_type": "execute_result"
6663
}
@@ -78,17 +75,9 @@
7875
},
7976
{
8077
"cell_type": "code",
81-
"execution_count": 4,
78+
"execution_count": 15,
8279
"metadata": {},
83-
"outputs": [
84-
{
85-
"name": "stdout",
86-
"output_type": "stream",
87-
"text": [
88-
"select * from employees;\n"
89-
]
90-
}
91-
],
80+
"outputs": [],
9281
"source": [
9382
"query = \"select * from employees;\"\n",
9483
"result = client.exec_query(query, conn)"
@@ -103,21 +92,21 @@
10392
},
10493
{
10594
"cell_type": "code",
106-
"execution_count": 5,
95+
"execution_count": 16,
10796
"metadata": {},
10897
"outputs": [
10998
{
11099
"name": "stdout",
111100
"output_type": "stream",
112101
"text": [
113-
"{'emp_id': 1, 'emp_name': b'Bobby Tables'}\n",
114-
"{'emp_id': 1, 'emp_name': b'Bobby Tables'}\n",
115-
"{'emp_id': 1, 'emp_name': b'Bobby Tables'}\n",
116-
"{'emp_id': 1, 'emp_name': b'Bobby Tables'}\n",
117-
"{'emp_id': 1, 'emp_name': b'Bobby Tables'}\n",
118-
"{'emp_id': 1, 'emp_name': b'Bobby Tables'}\n",
119-
"{'emp_id': 1, 'emp_name': b'Bobby Tables'}\n",
120-
"{'emp_id': 1, 'emp_name': b'Bobby Tables'}\n"
102+
"{'EmployeeId': '1', 'LastName': 'Adams', 'FirstName': 'Andrew', 'Title': 'General Manager', 'ReportsTo': None, 'BirthDate': '1962-02-18 00:00:00', 'HireDate': '2002-08-14 00:00:00', 'Address': '11120 Jasper Ave NW', 'City': 'Edmonton', 'State': 'AB', 'Country': 'Canada', 'PostalCode': 'T5K 2N1', 'Phone': '+1 (780) 428-9482', 'Fax': '+1 (780) 428-3457', 'Email': 'andrew@chinookcorp.com'}\n",
103+
"{'EmployeeId': '2', 'LastName': 'Edwards', 'FirstName': 'Nancy', 'Title': 'Sales Manager', 'ReportsTo': '1', 'BirthDate': '1958-12-08 00:00:00', 'HireDate': '2002-05-01 00:00:00', 'Address': '825 8 Ave SW', 'City': 'Calgary', 'State': 'AB', 'Country': 'Canada', 'PostalCode': 'T2P 2T3', 'Phone': '+1 (403) 262-3443', 'Fax': '+1 (403) 262-3322', 'Email': 'nancy@chinookcorp.com'}\n",
104+
"{'EmployeeId': '3', 'LastName': 'Peacock', 'FirstName': 'Jane', 'Title': 'Sales Support Agent', 'ReportsTo': '2', 'BirthDate': '1973-08-29 00:00:00', 'HireDate': '2002-04-01 00:00:00', 'Address': '1111 6 Ave SW', 'City': 'Calgary', 'State': 'AB', 'Country': 'Canada', 'PostalCode': 'T2P 5M5', 'Phone': '+1 (403) 262-3443', 'Fax': '+1 (403) 262-6712', 'Email': 'jane@chinookcorp.com'}\n",
105+
"{'EmployeeId': '4', 'LastName': 'Park', 'FirstName': 'Margaret', 'Title': 'Sales Support Agent', 'ReportsTo': '2', 'BirthDate': '1947-09-19 00:00:00', 'HireDate': '2003-05-03 00:00:00', 'Address': '683 10 Street SW', 'City': 'Calgary', 'State': 'AB', 'Country': 'Canada', 'PostalCode': 'T2P 5G3', 'Phone': '+1 (403) 263-4423', 'Fax': '+1 (403) 263-4289', 'Email': 'margaret@chinookcorp.com'}\n",
106+
"{'EmployeeId': '5', 'LastName': 'Johnson', 'FirstName': 'Steve', 'Title': 'Sales Support Agent', 'ReportsTo': '2', 'BirthDate': '1965-03-03 00:00:00', 'HireDate': '2003-10-17 00:00:00', 'Address': '7727B 41 Ave', 'City': 'Calgary', 'State': 'AB', 'Country': 'Canada', 'PostalCode': 'T3B 1Y7', 'Phone': '1 (780) 836-9987', 'Fax': '1 (780) 836-9543', 'Email': 'steve@chinookcorp.com'}\n",
107+
"{'EmployeeId': '6', 'LastName': 'Mitchell', 'FirstName': 'Michael', 'Title': 'IT Manager', 'ReportsTo': '1', 'BirthDate': '1973-07-01 00:00:00', 'HireDate': '2003-10-17 00:00:00', 'Address': '5827 Bowness Road NW', 'City': 'Calgary', 'State': 'AB', 'Country': 'Canada', 'PostalCode': 'T3B 0C5', 'Phone': '+1 (403) 246-9887', 'Fax': '+1 (403) 246-9899', 'Email': 'michael@chinookcorp.com'}\n",
108+
"{'EmployeeId': '7', 'LastName': 'King', 'FirstName': 'Robert', 'Title': 'IT Staff', 'ReportsTo': '6', 'BirthDate': '1970-05-29 00:00:00', 'HireDate': '2004-01-02 00:00:00', 'Address': '590 Columbia Boulevard West', 'City': 'Lethbridge', 'State': 'AB', 'Country': 'Canada', 'PostalCode': 'T1K 5N8', 'Phone': '+1 (403) 456-9986', 'Fax': '+1 (403) 456-8485', 'Email': 'robert@chinookcorp.com'}\n",
109+
"{'EmployeeId': '8', 'LastName': 'Callahan', 'FirstName': 'Laura', 'Title': 'IT Staff', 'ReportsTo': '6', 'BirthDate': '1968-01-09 00:00:00', 'HireDate': '2004-03-04 00:00:00', 'Address': '923 7 ST NW', 'City': 'Lethbridge', 'State': 'AB', 'Country': 'Canada', 'PostalCode': 'T1H 1Y8', 'Phone': '+1 (403) 467-3351', 'Fax': '+1 (403) 467-8772', 'Email': 'laura@chinookcorp.com'}\n"
121110
]
122111
}
123112
],
@@ -135,41 +124,12 @@
135124
},
136125
{
137126
"cell_type": "code",
138-
"execution_count": 6,
127+
"execution_count": 17,
139128
"metadata": {},
140129
"outputs": [],
141130
"source": [
142131
"client.disconnect(conn)\n"
143132
]
144-
},
145-
{
146-
"cell_type": "markdown",
147-
"metadata": {},
148-
"source": [
149-
"You can bind values to parametric queries: you can pass parameters as positional values in an array"
150-
]
151-
},
152-
{
153-
"cell_type": "code",
154-
"execution_count": 7,
155-
"metadata": {},
156-
"outputs": [
157-
{
158-
"name": "stdout",
159-
"output_type": "stream",
160-
"text": [
161-
"ev type: <class 'int'>\n",
162-
"ev type: <class 'str'>\n"
163-
]
164-
}
165-
],
166-
"source": [
167-
"new_connection = client.open_connection()\n",
168-
"result = client.exec_statement(\"select * from employees where emp_id = ? and emp_name = ? \", [1,'Bobby Tables'],conn=new_connection)\n",
169-
"for r in result:\n",
170-
" print(r)\n",
171-
"client.disconnect(conn)"
172-
]
173133
}
174134
],
175135
"metadata": {
@@ -188,7 +148,7 @@
188148
"name": "python",
189149
"nbconvert_exporter": "python",
190150
"pygments_lexer": "ipython3",
191-
"version": "3.11.6"
151+
"version": "3.6.15"
192152
}
193153
},
194154
"nbformat": 4,

0 commit comments

Comments
 (0)