1. F H
  2. Valentina Database ADK
  3. Среда, Октябрь 14 2020, 01:54 PM
  4.  Подписаться через email
I'm devolping a mall tool in python which uses several sqlitedatabases for storing the data. At the moment the tool ist importing regular during the night data into the database, so that I can use the data during the day. The Problem is, that my data is always round about 12 hours behind live which now is getting sometime a problem. Thats why I want to migrate my data to sqlite db server. First of all I installed the vserver on my kali linux desktop pc and stored the databases on a Synology NAS and mounted the folder. That works perfect.

Now my questions. Is it possible to access the database direct from my python source code. I installed the Python ADK from Valentina and tried to explore the given examples, but on my both systems I get different errormessages (like you can see in the attached screenshots). I tried a first test with the followig lines wich are based on the examples of VPython.



#!/usr/bin/python3

# Location of the extension (if need)
import sys
sys.path.append('/opt/VPython/')

# Import extension
import valentina


# Init valentina engine (don't need for client/server)
# valentina.init('VPTN-M-*', 'VPTN-W-*', 'VPTN-L-*')


print("test")

# Remote server without database
try:
#conn = valentina.connect('sa:sa@192.168.178.84/block_000000_200000')
conn = valentina.connect('sa:sa@127.0.0.1/block_000000_200000')

print("test2")
# Execute query
cursor = conn.cursor()
cursor.execute('SELECT count(*) FROM "block"')

# check some cursor properties:
print( "selected records count is:", cursor.rowcount )

for row in cursor:
print("Anzahl: " + str(row[0]))

cursor.close()
conn.close()
except Exception as e:
print("Error-Msg. System: "+str(e))



Can somebody help me with this Problem? What I'm doing wrong?

Thanks a lot

Fabian
Вложения
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Hello Fabian,

VPython for Raspberry Pi will be available in the next version (10.5.7).
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Hello Fabian,

1. No, as far as I remember, it is not implemented. I'll add more details about it.
2. Yes, there is a plan to build VPython for Raspberry Pi.
Комментарий
There are no comments made yet.
F H Ответ принят
Hello Sergey,

thank you for the information, I will try the VPython now. I have two additional questions:

1. Is it possible to create databases via the REST-API?
2. At the moment VPython on exists for 64bit systems. Is there a plan to develop it also for 32bit (Raspi-PI)?

Thank you very much.

Fabian
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Hello Fabian,

Thank you, we'll add the Python3 REST example.

As for the VPython, there were changes in just released 10.5.4:
- fixed running on Kali Linux
- added support for Valentina SQLite Server

Example of connection:
conn = valentina.connect('vsqlite://sa:sa@127.0.0.1/sqlite_sakila.sqlite')
Комментарий
There are no comments made yet.
F H Ответ принят
Hello Sergey,

I found the reason for the authentication problem.

Attached I have a working Python3-Rest-API-Connection, maybe somebody need it.
Вложения
Комментарий
There are no comments made yet.
F H Ответ принят
I already try to use the REST-AP but I always get the message, that username and password are not correct.

For my tests I converted the Examples from the Wiki into Python3. I attached my example, which doesn't work.

I already try to use the default user sa with the password sa, but this doesn't work. :(
Вложения
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Yes, there is also the REST interface.
Switch between Valentina/SQLite databases is done using the "vendor" property.
Ссылки
  1. http://valentina-db.com/docs/dokuwiki/v10/doku.php?id=valentina:articles:vserver_rest
Комментарий
There are no comments made yet.
F H Ответ принят
Is there another was to access the Sqlite Server via Python3?

My Kali Linux is Debian 5.4.19 from 17.02.2020 (Release 2020.1)
Комментарий
There are no comments made yet.
Ruslan Zasukhin Ответ принят
Hi,

1) Valentina SQLite Server was not added yet to VPython. On TODO.

2) Can you specify version of your Kali Linux?
Комментарий
There are no comments made yet.
  • Страница :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 2 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories