Comments (7)
From [email protected] on September 16, 2011 11:40:51
-David Bloom
from web2py.
From [email protected] on December 16, 2011 08:26:59
Accepted. Which of the current adapters is the closest to the OrientDB syntax (sqlite, myqsl, postgresql, mssql?)
Status: Accepted
from web2py.
From [email protected] on December 17, 2011 08:16:37
The rest of the SQL syntax is very much like MySQL/Postgres. See: https://code.google.com/p/orient/wiki/SQL I see a potential problem in that OrientDB uses strings for its id field. I haven't looked recently but as I understand it the dbs in dal.py use integers as id. The OrientDB wiki will explain it better than I:
"RecordID
In OrientDB each record has a unique ID. The RecordID is composed in this way: #[:] Where:
cluster, is the cluster id. Positive numbers mean physical clusters. Negative numbers mean logical clusters.
position, is the absolute position of the record inside a cluster.
NOTE: After the release 1.0rc4 the prefix character # is mandatory to recognize a RecordID.
The record never looses its identity unless is deleted. Once deleted its identity could be recycled and assigned to a new record. See the Inverse relationships to know more about this.
You can access directly to a record by knowing its RecordID. For this reason you don't need to create a field as primary key as happens in Relational DBMS. "
I hope the string as an ID issue can be overcome.
Not sure if it will help but I have had success in the meantime using the requests and ujson python libs to make HTTP requests to OrientDB's RESTful API and then .loads() the JSON response. There is a network binary protocol but I don't yet know how to have web2py and Orient communicate via binary.
It is an exciting prospect to combine web2py's flexibility with OrientDB's speed and analytical power. I think it would be amazing to not only have an adapter to web2py but also to have the communications somehow include running Gremlin graph traversals too.
Thanks again Massimo. I saw you so busy with the book and new versions and didn't think you'd get to my issue so soon. Do you ever sleep? :)
-David
from web2py.
From [email protected] on December 17, 2011 09:21:33
Can you point me to the function to obtain a new record id after a new record is inserted?
Do you ever sleep?
I did yesterday but I do not remember the previous time I did before yesteray. ;-)
Massimo
from web2py.
From [email protected] on December 17, 2011 10:10:25
Ha, glad you got at least one night's rest.
I wrote a little module which I used to parse the RID from the JSON result
of an INSERT.
Works great in /modules. Not sure if I need the from gluon import * bit
but left it as it was there when I created a new module.
/modules/orientdb_utils.py
#!/usr/bin/env python
coding: utf8
from gluon import *
import re
def RidFromInsert(resultstr):
regxrslt = re.search( '#\d+:\d+', resultstr )
return regxrslt.group(0)
Example of using requests, ujson and module to insert a record and retrieve
it's new RID.
This assumes a running OrientDB instance on the localhost with a database
called "web2pyrules" and has a schema that has a cluster called Category
Think of OrientDB cluster = MySQL table. A way to group information except
it can be schema-full/mixed/less
import requests
import ujson as json # Faster JSON
from orientdb_utils import RidFromInsert
r = requests.post('http://localhost:2480/command/web2pyrules/sql'
data="INSERT INTO Category (name) VALUES ('web2py')", auth=('writer',
'writer'))
result = json.loads(r.content)
cat_id = RidFromInsert(result)
I don't know if it would be useful but I also wrote a module to add/remove
in/out edges to a vertex when using OrientDB as a document-graph db. It
also uses the RESTful API similar to above.
from web2py.
From [email protected] on August 07, 2012 19:46:43
Labels: -Type-Defect Type-Enhancement
from web2py.
@niphlod Moved to web2py/pydal#321. Can you close this?
from web2py.
Related Issues (20)
- Admin application fails on Python 3.10 in version 2.23.0 HOT 2
- SSLv3 unknown certificate
- web2py 2.23.0 is giving a 403 error when I try to package my applications
- SECURITY: JQuery 1.2 < 3.5.0 Multiple XSS
- Scheduler does not exit on OperationalError HOT 9
- Lack of checking if the supplied value is numerical in SQLFORM.grid search function HOT 2
- scheduler.py AttributeError: '_thread._local' object has no attribute '_scheduler'
- SECURITY: Vulnerable to HTTP Response Splitting
- Error when searching with SQLFORM.grid with order field selected HOT 1
- Add to book recipie? - How to host web2py with python3 on cpanel server
- blank admin
- Circular import
- About Sessions Storage
- web2py does not work with Python 3.12 HOT 3
- The new version (2.27.1) does not work for me HOT 1
- SECURITY.md contains no email contact
- db.export_to_csv_file does not correctly back up a database with record versioning enabled. HOT 2
- web2Py admin pages cant be opened when the webserver is behind a (reverse) proxy Server
- pydal 20240427 breaks gluon/login HOT 1
- Record versioning blocks update occasionally
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web2py.