lemoussel / pydbhub Goto Github PK
View Code? Open in Web Editor NEWA Python library for accessing and using SQLite databases on DBHub.io
License: MIT License
A Python library for accessing and using SQLite databases on DBHub.io
License: MIT License
As a data point, the DBHub.io API has been updated to version 0.2 in order to support our new (experimental) "Live" databases.
These "Live" ones aren't version controlled like the existing "Standard" databases, and can have write queries executed on them. eg INSERT
, UPDATE
, DELETE
(etc)
The main differences in the API are:
The Databases()
call now has an optional live
boolean parameter. If that's set to true
, it'll return a list of "Live" databases in the user account. If that's any other value, or missing, it'll return the list of "Standard" databases in the user account.
The Upload()
call has the same optional live
boolean parameter. If it's set to true
then the uploaded database goes into a new backend system (not version controlled, allows write queries). If that boolean parameter is any other value (or missing), then the uploaded database will be a "Standard" database upload.
There's a new Execute()
function, so people can run write queries against their Live databases.
In theory, it should be simple to update pydbhub to support the new version. If anything does turn out to be non-obvious or weird though, please let me know so it can be looked at / fixed. ๐
Would it be appropriate or needed to create a tutorial for the app?
I'm thinking a walk-through of specific features that you list on the first page of the repo.
This was recommended by a friend so I am new to the DB app but have wanted to dig deeper into SQLite.
As a new contributor, I would like to help, are there documentation needs or low-level bugs that we need to address?
on Windows 11 with Python 3.8 at a Dos command prompt I ran
pip install pydbhub
the log suggested that it installed the required packages but it did not install pydbhub itself
there were no errors, at the end of the install
lib\site-packages\pydbhub-0.0.3.dist-info was created
lib\site-packages\pydbhub was not created (but if I manually create the directory and copy the three py files from github it works)
The install log
(z99) C:\Users\Chris Johnson\Python\z99>pip list
Package Version
---------- -------
pip 21.1.1
setuptools 56.0.0
WARNING: You are using pip version 21.1.1; however, version 22.3.1 is available.
You should consider upgrading via the 'c:\users\chris johnson\python\z99\scripts\python.exe -m pip install --upgrade pip' command.
(z99) C:\Users\Chris Johnson\Python\z99>pip install pydbhub
Collecting pydbhub
Using cached pydbhub-0.0.3-py37-none-any.whl (3.0 kB)
Collecting requests
Using cached requests-2.28.1-py3-none-any.whl (62 kB)
Collecting python-dateutil
Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting rich
Using cached rich-12.6.0-py3-none-any.whl (237 kB)
Collecting six>=1.5
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting certifi>=2017.4.17
Using cached certifi-2022.9.24-py3-none-any.whl (161 kB)
Collecting idna<4,>=2.5
Using cached idna-3.4-py3-none-any.whl (61 kB)
Collecting urllib3<1.27,>=1.21.1
Using cached urllib3-1.26.12-py2.py3-none-any.whl (140 kB)
Collecting charset-normalizer<3,>=2
Using cached charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
Collecting pygments<3.0.0,>=2.6.0
Using cached Pygments-2.13.0-py3-none-any.whl (1.1 MB)
Collecting commonmark<0.10.0,>=0.9.0
Using cached commonmark-0.9.1-py2.py3-none-any.whl (51 kB)
Collecting typing-extensions<5.0,>=4.0.0
Using cached typing_extensions-4.4.0-py3-none-any.whl (26 kB)
Installing collected packages: urllib3, typing-extensions, six, pygments, idna, commonmark, charset-normalizer, certifi, rich, requests, python-dateutil, pydbhub
Successfully installed certifi-2022.9.24 charset-normalizer-2.1.1 commonmark-0.9.1 idna-3.4 pydbhub-0.0.3 pygments-2.13.0 python-dateutil-2.8.2 requests-2.28.1 rich-12.6.0 six-1.16.0 typing-extensions-4.4.0 urllib3-1.26.12
WARNING: You are using pip version 21.1.1; however, version 22.3.1 is available.
You should consider upgrading via the 'c:\users\chris johnson\python\z99\scripts\python.exe -m pip install --upgrade pip' command.
(z99) C:\Users\Chris Johnson\Python\z99>
after the install libraries such as rich are installed correctly but pydbhub is missing although pip lists it
(z99) C:\Users\Chris Johnson\Python\z99>dir .\lib\site-packages\pydb*
Volume in drive C is OS
Volume Serial Number is 1EFF-F90D
Directory of C:\Users\Chris Johnson\Python\z99\lib\site-packages
18/11/2022 20:45 <DIR> pydbhub-0.0.3.dist-info
0 File(s) 0 bytes
1 Dir(s) 74,464,223,232 bytes free
(z99) C:\Users\Chris Johnson\Python\z99>
Hi. Nice library!
Was trying to run a query but was not working:
TypeError: () takes 0 positional arguments but 1 was given
The piece of code starting at line 463:
for result_row in res:
one_row = {}
for data in result_row:
result = {
0: lambda v: base64.b64decode(v.encode('ascii')) if isinstance(v, str) else None, # Binary
1: lambda: "", # Image - just output as an empty string (for now)
2: lambda: None, # Null
3: lambda v: str(v) if isinstance(v, str) else "", # Text
4: lambda v: int(v), # Integer
5: lambda v: float(v) # Float
}[data['Type']](data['Value'])
one_row.update({data['Name']: result})
rows.append(one_row)
Passes a parameter to the anonymous function in cases 1 and 2, but it does not expect any parameter.
Fixed jus adding the parameter that simply is not used:
for result_row in res:
one_row = {}
for data in result_row:
result = {
0: lambda v: base64.b64decode(v.encode('ascii')) if isinstance(v, str) else None, # Binary
1: lambda v: "", # Image - just output as an empty string (for now)
2: lambda v: None, # Null
3: lambda v: str(v) if isinstance(v, str) else "", # Text
4: lambda v: int(v), # Integer
5: lambda v: float(v) # Float
}[data['Type']](data['Value'])
one_row.update({data['Name']: result})
rows.append(one_row)
Cheers,
Daniel.
I've struggle to install pydbhub via pip.
The installation seem to be finished, but i was't able to import pydbhub, and pydbhub wan't shown in the package list using pip list
.
@ Python 3.7.9
>>>pip install pydbhub --user
Collecting pydbhub
Downloading pydbhub-0.0.3-py37-none-any.whl (3.0 kB)
Collecting rich
Downloading rich-10.15.2-py3-none-any.whl (214 kB)
Requirement already satisfied: requests in c:\users\mdotzauer\appdata\roaming\python\python37\site-packages (from pydbhub) (2.25.1)
Requirement already satisfied: python-dateutil in c:\users\mdotzauer\appdata\roaming\python\python37\site-packages (from pydbhub) (2.8.1)
Requirement already satisfied: six>=1.5 in c:\users\mdotzauer\appdata\roaming\python\python37\site-packages (from python-dateutil->pydbhub) (1.14.0)
Requirement already satisfied: chardet<5,>=3.0.2 in c:\users\mdotzauer\appdata\roaming\python\python37\site-packages (from requests->pydbhub) (3.0.4)
Requirement already satisfied: idna<3,>=2.5 in c:\users\mdotzauer\appdata\roaming\python\python37\site-packages (from requests->pydbhub) (2.10)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\mdotzauer\appdata\roaming\python\python37\site-packages (from requests->pydbhub) (1.26.4)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\mdotzauer\appdata\roaming\python\python37\site-packages (from requests->pydbhub) (2021.5.30)
Collecting colorama<0.5.0,>=0.4.0
Downloading colorama-0.4.4-py2.py3-none-any.whl (16 kB)
Collecting typing-extensions<5.0,>=3.7.4
Downloading typing_extensions-4.0.1-py3-none-any.whl (22 kB)
Collecting pygments<3.0.0,>=2.6.0
Downloading Pygments-2.10.0-py3-none-any.whl (1.0 MB)
Collecting commonmark<0.10.0,>=0.9.0
Downloading commonmark-0.9.1-py2.py3-none-any.whl (51 kB)
Installing collected packages: typing-extensions, pygments, commonmark, colorama, rich, pydbhub
Successfully installed colorama-0.4.4 commonmark-0.9.1 pydbhub-0.0.3 pygments-2.10.0 rich-10.15.2 typing-extensions-4.0.1
But can't access the library:
>>> import pydbhub
Traceback (most recent call last):
File "<console>", line 1, in <module>
ModuleNotFoundError: No module named 'pydbhub'
And also I've found just a folder "pydbhub-0.0.3.dist-info" but no package folder.
If any further information is needed I'll try to serve it.
Thanks in advance,
Martin
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.