[web2py] MongoDB

2018-11-09 Thread lbjc1978
I keep getting this information on my terminal.
WARNING:pyDAL:Attributes 'required', 'cache' and 'cacheable' are 
unsupported by MongoDB
Enter code here...


How can I solve it?
Regards

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Mongodb Error

2018-10-30 Thread lbjc1978
I'm trying to use MongoDB for the first time. I looked at this 

 link 
as one of the guidance. but ended up with an error.
My code below:

from gluon import current
from pymongo import MongoClient
from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
from gluon.custom_import import track_changes
track_changes(True)
db = DAL('mongodb://username:password@localhost/test', pool_size=0)
Post = db.define_table('post',
   Field('author', 'reference auth_user', default=auth.
user_id, writable=False, readable=False),
   Field('comments', 'text', requires=IS_NOT_EMPTY(),
 default ="Hi there it's me", notnull=False),
   auth.signature
   )




Error:

  File "/home/maurice/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/home/maun/web2py/applications/boyeve/models/db2.py" 
, line 12, in 

db = DAL('mongodb://username:password@localhost/test', pool_size=0)
  File "/usr/local/lib/python2.7/dist-packages/pydal/base.py", line 169, in 
__call__
obj = super(MetaDAL, cls).__call__(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pydal/base.py", line 474, in 
__init__
"Failure to connect, tried %d times:\n%s" % (attempts, tb)
RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pydal/base.py", line 454, in 
__init__
self._adapter = adapter(**kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/__init__.py", 
line 40, in __call__
obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/base.py", line 
52, in __init__
self.reconnect()
  File "/usr/local/lib/python2.7/dist-packages/pydal/helpers/classes.py", line 
184, in _reconnect_and_configure
self._configure_on_first_reconnect()
  File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/mongo.py", line 
79, in _configure_on_first_reconnect
"serverStatus")['version']
  File "/usr/local/lib/python2.7/dist-packages/pymongo/database.py", line 611, 
in command
read_preference) as (sock_info, slave_ok):
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
  File "/usr/local/lib/python2.7/dist-packages/pymongo/mongo_client.py", line 
1101, in _socket_for_reads
with self._get_socket(server) as sock_info:
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
  File "/usr/local/lib/python2.7/dist-packages/pymongo/mongo_client.py", line 
1058, in _get_socket
with server.get_socket(self.__all_credentials) as sock_info:
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
  File "/usr/local/lib/python2.7/dist-packages/pymongo/pool.py", line 1006, in 
get_socket
sock_info.check_auth(all_credentials)
  File "/usr/local/lib/python2.7/dist-packages/pymongo/pool.py", line 677, in 
check_auth
auth.authenticate(credentials, self)
  File "/usr/local/lib/python2.7/dist-packages/pymongo/auth.py", line 563, in 
authenticate
auth_func(credentials, sock_info)
  File "/usr/local/lib/python2.7/dist-packages/pymongo/auth.py", line 540, in 
_authenticate_default
return _authenticate_scram(credentials, sock_info, 'SCRAM-SHA-1')
  File "/usr/local/lib/python2.7/dist-packages/pymongo/auth.py", line 262, in 
_authenticate_scram
res = sock_info.command(source, cmd)
  File "/usr/local/lib/python2.7/dist-packages/pymongo/pool.py", line 579, in 
command
unacknowledged=unacknowledged)
  File "/usr/local/lib/python2.7/dist-packages/pymongo/network.py", line 150, 
in command
parse_write_concern_error=parse_write_concern_error)
  File "/usr/local/lib/python2.7/dist-packages/pymongo/helpers.py", line 155, 
in _check_command_response
raise OperationFailure(msg % errmsg, code, response)
OperationFailure: Authentication failed.


I need help to solve this

Regards

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Problem with codification in web2py+mongodb

2017-02-17 Thread Yasmany Yantalla

I am using web2py version 2.14.6-stable + timestamp.2016.05.10.00.21.47 
with mongodb version 2.6, when using the fields list: string these are 
inserted correctly in the database but when they are modified they change 
coding eg [u ' Zxcvzxc '], [u'zxc'], [u'vzxcv '], [u'zx'], []
  Sorry for my English

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] mongoDB dal adapter and dbref

2016-04-21 Thread luis . valladares
Hello!

I've been looking in web2py book and in pydal documentation searching 
information about the implementation of mongo database reference 
(https://docs.mongodb.org/manual/reference/database-references/) but didnt 
find anything. This is implemented in some way by pyDAL?

Thanks for your help!

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Mongodb api reference

2015-05-09 Thread Alan Etkin

I'm bringing to the list some new user's questions

It will b nice to document all the DAL syntax n equivalent pymongo api.


Not sure what he meant, but documenting the pymongo api makes little sense 
(it is already documented by the authors). IMO we should instead document 
the way of accessing the adapter connection to use the pymongo api commands 
or any adapter (maybe it is already documented).
 

 N all the DAL doesnt apply to pymongo n added pymongo features.  Just 
 saying:)


DAL only uses pymongo features required by the DAL api itself, but there's 
no equivalent command between the lower level api and DAL.

It will b nice to document all the DAL syntax n equivalent pymongo api. N 
 all the DAL doesnt apply to pymongo n added pymongo features.


mongodb adapter is not meant to include or extend pymongo api commands, it 
is a high level interface for mongodb databases in web2py apps

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py-mongodb-engine

2015-05-07 Thread Paolo Valleri
I don't see any problem at all in implementing a common post-comment page 
in web2py.
You can code it independently from the backend. 

On Wednesday, May 6, 2015 at 8:28:08 PM UTC+2, Ron Chatterjee wrote:

 Here is another tutorial from django:


 *http://docs.mongodb.org/manual/tutorial/write-a-tumblelog-application-with-django-mongodb-engine/
  
 http://docs.mongodb.org/manual/tutorial/write-a-tumblelog-application-with-django-mongodb-engine/*


 Pretty cool. Wondering if we can have a web2py version implementing the 
 same with mongodb.  Any thoughts any one?



 On Tuesday, May 5, 2015 at 4:49:08 PM UTC-4, Ron Chatterjee wrote:

 I was wondering about creating an object inside an object. As shown in 
 the link above:

 {
   'created_on': ISODate('...'),
   'author_name' : 'Bob',
'author_email': 'b...@example.org javascript:',
   'text' : 'The cake is a lie'
 }


 instead of that dict someone can also write it as:


 {
   'created_on': ISODate('...'),
   'author' : {
 'name': 'Bob',
 'email': 'b...@example.org javascript:'
   },
   'text' : 'The cake is a lie'}



 Django handles with EmbeddedModelField. How does web2py handles that? 
 I am thinking there must be a way.


 On Tuesday, May 5, 2015 at 12:58:48 PM UTC-4, Cássio Botaro wrote:

 Actually DAL have experimental mongodb support.
 You can see 
 http://www.web2pyslices.com/slice/show/1580/save-the-earth-from-a-total-data-mess-with-mongodbadapter



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py-mongodb-engine

2015-05-07 Thread Ron Chatterjee
Below is what I have the model in django. I can do the ListField() in 
web2py using list:string I believe but I am having problem with how to do 
EmbeddedModelField! in web2py. I don't understand what you mean by do it 
independently of backend! Do you mean to insert the table in mongodb 
independently and somehow then call from web2py to create the DAL object? 




from django.db import modelsfrom django.core.urlresolvers import reverse
from djangotoolbox.fields import ListField, EmbeddedModelField

class Post(models.Model):
created_at = models.DateTimeField(auto_now_add=True, db_index=True)
title = models.CharField(max_length=255)
slug = models.SlugField()
body = models.TextField()
comments = ListField(EmbeddedModelField('Comment'), editable=False)

def get_absolute_url(self):
return reverse('post', kwargs={slug: self.slug})

def __unicode__(self):
return self.title

class Meta:
ordering = [-created_at]

class Comment(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
body = models.TextField(verbose_name=Comment)
author = models.CharField(verbose_name=Name, max_length=255)






On Thursday, May 7, 2015 at 3:26:00 AM UTC-4, Paolo Valleri wrote:

 I don't see any problem at all in implementing a common post-comment page 
 in web2py.
 You can code it independently from the backend. 

 On Wednesday, May 6, 2015 at 8:28:08 PM UTC+2, Ron Chatterjee wrote:

 Here is another tutorial from django:


 *http://docs.mongodb.org/manual/tutorial/write-a-tumblelog-application-with-django-mongodb-engine/
  
 http://docs.mongodb.org/manual/tutorial/write-a-tumblelog-application-with-django-mongodb-engine/*


 Pretty cool. Wondering if we can have a web2py version implementing the 
 same with mongodb.  Any thoughts any one?



 On Tuesday, May 5, 2015 at 4:49:08 PM UTC-4, Ron Chatterjee wrote:

 I was wondering about creating an object inside an object. As shown in 
 the link above:

 {
   'created_on': ISODate('...'),
   'author_name' : 'Bob',
'author_email': 'b...@example.org',
   'text' : 'The cake is a lie'
 }


 instead of that dict someone can also write it as:


 {
   'created_on': ISODate('...'),
   'author' : {
 'name': 'Bob',
 'email': 'b...@example.org'
   },
   'text' : 'The cake is a lie'}



 Django handles with EmbeddedModelField. How does web2py handles that? 
 I am thinking there must be a way.


 On Tuesday, May 5, 2015 at 12:58:48 PM UTC-4, Cássio Botaro wrote:

 Actually DAL have experimental mongodb support.
 You can see 
 http://www.web2pyslices.com/slice/show/1580/save-the-earth-from-a-total-data-mess-with-mongodbadapter



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py-mongodb-engine

2015-05-07 Thread Alan Etkin
I did not check the django app code but if you want to handle embedded json 
objects you should use table definitions with a json field.

Something like
db.define_table(mytable, Field(embeddedobject, json) # db is a 
mongodb connection (DAL instance)


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py-mongodb-engine

2015-05-07 Thread Ron Chatterjee
Thank you Alan and Massimo and others. I didn't realize mongodb adaptor 
support reference field. My bad.

Thanks for all the help guys.


On Thursday, May 7, 2015 at 9:59:58 AM UTC-4, Alan Etkin wrote:

 I did not check the django app code but if you want to handle embedded 
 json objects you should use table definitions with a json field.

 Something like
 db.define_table(mytable, Field(embeddedobject, json) # db is a 
 mongodb connection (DAL instance)




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] MongoDB

2015-05-06 Thread José Ricardo Borba
I'm very busy in these days, but I tried to start a new installation from
the ground (to test the TIME issue with Mongodb in pydal #170), but even
without this correction (i.e, with plain web2py clone from github) I
receive the below error message.

I'm simply copy the application folder to the new installation
(side-by-side with welcome and examples). With CLI client (mongo)
everything works fine.

The welcome app works fine.

I see that pydal tries to connect 5 times. The string to connect to mongo
is fine (since is a local install. In production will have an user and a
password too...).
Version  web2py™ Version 2.10.4-stable+timestamp.2015.04.26.09.05.21
Traceback

Traceback (most recent call last):
  File /home/mydir/w2p210b/gluon/restricted.py, line 227, in restricted
exec ccode in environment
  File /home/mydir/w2p210b/applications/rastreamento/models/db.py
http://localhost:8000/admin/default/edit/rastreamento/models/db.py,
line 12, in module
db = DAL('mongodb://localhost/telemet', pool_size=0, lazy_tables=True)
  File /home/mydir/w2p210b/gluon/packages/dal/pydal/base.py, line
174, in __call__
obj = super(MetaDAL, cls).__call__(*args, **kwargs)
  File /mydir/w2p210b/gluon/packages/dal/pydal/base.py, line 459, in __init__
raise RuntimeError(Failure to connect, tried %d times:\n%s %
(attempts, tb))
RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
  File /home/mydir/w2p210b/gluon/packages/dal/pydal/base.py, line
437, in __init__
self._adapter = ADAPTERS[self._dbname](**kwargs)
  File /home/mydir/w2p210b/gluon/packages/dal/pydal/adapters/base.py,
line 57, in __call__
obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
  File /home/mydir/w2p210b/gluon/packages/dal/pydal/adapters/mongo.py,
line 58, in __init__
from pymongo.write_concern import WriteConcern
  File /home/mydir/w2p210b/gluon/custom_import.py, line 108, in
custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
ImportError: No module named write_concern




Best regards,
-- 
José Ricardo Borba

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py-mongodb-engine

2015-05-06 Thread Ron Chatterjee
Here is another tutorial from django:


*http://docs.mongodb.org/manual/tutorial/write-a-tumblelog-application-with-django-mongodb-engine/*


Pretty cool. Wondering if we can have a web2py version implementing the 
same with mongodb.  Any thoughts any one?



On Tuesday, May 5, 2015 at 4:49:08 PM UTC-4, Ron Chatterjee wrote:

 I was wondering about creating an object inside an object. As shown in the 
 link above:

 {
   'created_on': ISODate('...'),
   'author_name' : 'Bob',
'author_email': 'b...@example.org',
   'text' : 'The cake is a lie'
 }


 instead of that dict someone can also write it as:


 {
   'created_on': ISODate('...'),
   'author' : {
 'name': 'Bob',
 'email': 'b...@example.org'
   },
   'text' : 'The cake is a lie'}



 Django handles with EmbeddedModelField. How does web2py handles that? I 
 am thinking there must be a way.


 On Tuesday, May 5, 2015 at 12:58:48 PM UTC-4, Cássio Botaro wrote:

 Actually DAL have experimental mongodb support.
 You can see 
 http://www.web2pyslices.com/slice/show/1580/save-the-earth-from-a-total-data-mess-with-mongodbadapter



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py-mongodb-engine

2015-05-05 Thread Cássio Botaro
Actually DAL have experimental mongodb support.
You can 
see 
http://www.web2pyslices.com/slice/show/1580/save-the-earth-from-a-total-data-mess-with-mongodbadapter

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] web2py-mongodb-engine

2015-05-05 Thread Ron Chatterjee
Is there a tutorial similar to this exist anywhere that anyone know off? In 
otherwords, do we have have web2py-mongodb engine that we can use the 
embedded model?

http://django-mongodb-engine.readthedocs.org/en/latest/tutorial.html#embedded-models

I believe the view in django is similar to models in web2py. 



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py-mongodb-engine

2015-05-05 Thread Ron Chatterjee
I was wondering about creating an object inside an object. As shown in the 
link above:


{
  'created_on': ISODate('...'),
  'author' : {
'name': 'Bob',
'email': 'b...@example.org'
  },
  'text' : 'The cake is a lie'}




instead of that dict someone can also write it as:


{
  'created_on': ISODate('...'),
  'author_name' : 'Bob',
   'author_email': 'b...@example.org',
  'text' : 'The cake is a lie'}


Django handles with EmbeddedModelField. How does web2py handles that? 


On Tuesday, May 5, 2015 at 12:58:48 PM UTC-4, Cássio Botaro wrote:

 Actually DAL have experimental mongodb support.
 You can see 
 http://www.web2pyslices.com/slice/show/1580/save-the-earth-from-a-total-data-mess-with-mongodbadapter


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] MongoDB adapter

2015-05-01 Thread José Ricardo Borba
Hi 4 All,

I'm new to mongoDB and still having some problems with a TIME field. When I
set a TIME field in the table, fill the input field of a sqlform (only time
is allowed) and send the data to table, all the record is inserted without
any warning. But when I try to show in the sqlform, I receive a message:

pre
code
  Traceback (most recent call last):
  File /home/xxx.../applications/ras/controllers/appadmin.py, line 269,
in select
*fields, limitby=(start, stop))
  File /home/xxx.../gluon/packages/dal/pydal/objects.py, line 2026, in
select
return adapter.select(self.query,fields,attributes)
  File /home/xxx.../gluon/packages/dal/pydal/adapters/mongo.py, line 353,
in select
result = processor(rows, fields, newnames, False)
  File /home/xxx.../gluon/packages/dal/pydal/adapters/base.py, line 1596,
in parse
value = self.parse_value(value,ft,blob_decode)
  File /home/xxx.../gluon/packages/dal/pydal/adapters/base.py, line 1450,
in parse_value
return self.parsemap[key](value,field_type)
  File /home/xxx.../gluon/packages/dal/pydal/adapters/base.py, line 1472,
in parse_time
time_items = map(int,str(value)[:8].strip().split(':')[:3])
ValueError: invalid literal for int() with base 10: '2000-01-'
/code
/pre

Trying to understand what happened, I'm googled for some info, and found
the Mongo adapter code (yes, I didn't tried in my own computer).

Reading the code (in pydal/adapters/mongo.py), I see a (possible) clue: The
lines 148 to 163 is, in some way, weird for my reading. Maybe I
misunderstood some point, but this

pre
code
t = datetime.time(0,0,0)
/code
/pre

is a formatter for a field type DATE, and this

pre
code
t = datetime.date(2000,1,1)
/code
/pre

is a formatter for a field type TIME ?

Best regards, and keep going the invaluable work with this framework.

-- 
José Ricardo Borba

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] MongoDB and Web2py in Windows

2014-11-28 Thread Oliver
Hi All,

anyone have success using MongoDb in DAL?  When I ran web2py, I don't see 
MongoDB listed.

here is what I got when I ran web2py command

web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2014
Version 2.9.11-stable+timestamp.2014.09.15.23.35.11
Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
PostgreSQL(psycopg2
), PostgreSQL(pg8000), MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), 
Ingres(pyod
bc), IMAP(imaplib)


I installed Pymongo.  I downloaded and installed MongoDB in my Windows 7 
and 8 computer to test.  Same result.

Thanks






-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Web2py MongoDB in Windows

2014-11-28 Thread Oliver
Hi All,

I'm having issue with Web2Py and MonogoDB in Windows 7.  When I ran the cmd 
web2py, I don't see MongoDB driver database  as available.  Howerver, I 
installed the Pymongo driver and installed MongoDB successfully in my pc.

Here is what I see when I do web2py command:

Created by Massimo Di Pierro, Copyright 2007-2014
Version 2.9.11-stable+timestamp.2014.09.15.23.35.11
Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
PostgreSQL(psycopg2
), PostgreSQL(pg8000), MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), 
Ingres(pyod
bc), IMAP(imaplib)

Your help is appreciated.  Thanks

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web2py MongoDB in Windows

2014-11-28 Thread Niphlod
are you using the binary or the source distribution ?

On Friday, November 28, 2014 5:05:22 PM UTC+1, Oliver wrote:

 Hi All,

 I'm having issue with Web2Py and MonogoDB in Windows 7.  When I ran the 
 cmd web2py, I don't see MongoDB driver database  as available.  Howerver, I 
 installed the Pymongo driver and installed MongoDB successfully in my pc.

 Here is what I see when I do web2py command:

 Created by Massimo Di Pierro, Copyright 2007-2014
 Version 2.9.11-stable+timestamp.2014.09.15.23.35.11
 Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
 PostgreSQL(psycopg2
 ), PostgreSQL(pg8000), MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), 
 Ingres(pyod
 bc), IMAP(imaplib)

 Your help is appreciated.  Thanks



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] mongoDB connect via db._adapter.connection

2014-06-01 Thread Andrey K
Dear users, 
I have a dilemma of how to access mongoDB and pymongo in the best way using 
DAL and pymongo.

Could you please explain how to use the approach of using pymongodb 
connection via 
 mycon = db._adapter.connection and what would be the difference between 
it and normal DAL connection to mongoDB. Can you tell what is the best 
connect to pymongo lib in web2py application. As I saw thinks like(
https://groups.google.com/forum/#!searchin/web2py/db._adapter.connection/web2py/TH7jCeFicmU/kzuAkHGooX0J
):

def make_connection(): 
 from pymongo import Connection 
 connection = Connection('localhost', 27017) 
return connection 

connection = cache.ram('mongodb',make_connection,None) 

I am not sure weather it is old or new tricks. It would be great to know 
what is the best approach as I could not find enough info on it even though 
i have tried to read all post on web2py group about pymongo subject.

Thank you in advance.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] mongodb type 'exceptions.RuntimeError' you must specify a Field(...,uploadfolder

2014-02-23 Thread Mr. J.S Jones
When using upload fields with mongodb and SQLFORM (not factory forms) I get 
the runtime error type 'exceptions.RuntimeError' you must specify a 
Field(...,uploadfolder=...) the same code but switching to sqlite works 
correctly. Adding db.table.field.uploadfolder = 
os.path.join(request.folder,'uploads')  to the controller before processing 
the form resolves the issue. I believe this might be a bug in the mongodb 
adapter. 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] MongoDb

2013-12-30 Thread Tushar Tuteja
I have an app running on MySQL , I want to use mongoDB instead. 
I want to help on migration from mysql to mongoDB.
Thanks,

regards,

Tushar Tuteja

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] mongodb upload field raising exception data must be an instance of str

2013-11-14 Thread Francisco Betancourt
Hello everyone.

We are using a mongodb for our application an ran into a little problem. 

We declare the following table:

db.define_table(pricing_plan,
Field(title, string, notnull=True),
Field(image, upload),
Field(description, text),
Field(price, integer, notnull=True ))

And when we try to populate some info through the database administrator in 
the admin interface we get the following error:

type 'exceptions.TypeError' data must be an instance of str Versión  
web2py™ Version 2.7.4-stable+timestamp.2013.10.14.15.16.29  Python Python 
2.7.3: /usr/bin/python (prefix: /usr)  Traceback 

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.

Traceback (most recent call last):
  File /home/francisco/bytecam/web2py/gluon/restricted.py, line 217, in 
restricted
exec ccode in environment
  File 
/home/francisco/bytecam/web2py/applications/olifant/controllers/appadmin.py 
http://127.0.0.1:8000/admin/default/edit/olifant/controllers/appadmin.py, 
line 635, in module
  File /home/francisco/bytecam/web2py/gluon/globals.py, line 372, in lambda
self._caller = lambda f: f()
  File 
/home/francisco/bytecam/web2py/applications/olifant/controllers/appadmin.py 
http://127.0.0.1:8000/admin/default/edit/olifant/controllers/appadmin.py, 
line 152, in insert
if form.accepts(request.vars, session):
  File /home/francisco/bytecam/web2py/gluon/sqlhtml.py, line 1518, in accepts
self.vars.id = self.table.insert(**fields)
  File /home/francisco/bytecam/web2py/gluon/dal.py, line 8781, in insert
ret =  self._db._adapter.insert(self, self._listify(fields))
  File /home/francisco/bytecam/web2py/gluon/dal.py, line 5614, in insert
values = self._insert(table, fields)
  File /home/francisco/bytecam/web2py/gluon/dal.py, line 5604, in _insert
values[fieldname] = self.represent(v, fieldtype)
  File /home/francisco/bytecam/web2py/gluon/dal.py, line 5408, in represent
return Binary(value)
  File /usr/lib/python2.7/dist-packages/bson/binary.py, line 109, in __new__
instance of %s % (binary_type.__name__,))
TypeError: data must be an instance of str


At first I thought we were doing something wrong, but after checking 
several times our code I decied to look at the dal code and it seem that 
line 5408 is trying to convert None in a Binary. I put the code fragment 
below.

5405elif fieldtype == blob:
5406from bson import Binary
5407if not isinstance(value, Binary):
5408return Binary(value)
5409return value

In the python console I did:

from bson import Binary

and then

Binary(None)

and it returns the same error. The thing is how do I fix this? I tried:

5405elif fieldtype == blob:
if value== None:
return value
5406from bson import Binary
5407if not isinstance(value, Binary):
5408return Binary(value)
5409return value

But ain't sure if that is right or not.

Hope someone can help me. Thanks.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] mongodb support

2013-10-23 Thread Thomas Tang
Hi,
can anyone advise the current status of web2py support of mongodb?
thanks
thomas

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] mongodb support

2013-10-23 Thread Thomas Tang
Hi Alan,
thanks. I played with it few months back and got something basic feature 
working but went into problem when I tried to use it for large object.
just checking if there is any enhancement made n the adapter.
I am using it for  small project and do some more evalution on the adapter.
Thomas

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] MongoDB and list:reference?

2013-06-04 Thread Alex Schlegel
I am having a problem using a list:reference field with a MongoDB database, 
like so:
db.define_table('page',
...
Field('id_moderator','list:reference auth_user',default=auth.user_id),
...
)


When I insert a record into this table with a list for the id_moderator 
field, like so:
db.page.insert(...,id_moderator=[id_owner],...)

I get the error:  object_id argument must be of type ObjectId or an 
objectid representable integer

because the MongoDBAdapter is not expecting the field's value to be a 
list.  Is this not the correct way to set list:reference type fields?

By the way, I can get around this by changing this line in MongoDBAdapter's 
insert function in dal.py:
values[fieldname] = self.object_id(v)

to this:
if isinstance(v,list):
values[fieldname] = [self.object_id(x) for x in v]
else:
values[fieldname] = self.object_id(v)

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Image in web2py/MongoDB based blog

2013-03-27 Thread Hugo Costa
Thanks for the answer.

Isn't there a way to put images using links from other storage websites in 
the form? Because I'm not going to be the only administrating the site and 
they won't know how to work with the thing in that first link.

Terça-feira, 26 de Março de 2013 21:51:21 UTC, Alan Etkin escreveu:

  but I want to know how can I put an image/video in the text making them 
 appear in the view of the user.
  I tried using with HTML code but it didn't work.

 Where will the images come from?

 Will you store image files in you app folder?

 Here is a guide to handle images from the book:

 http://www.web2py.com/books/default/chapter/29/03#An-image-blog

 If you just need a way of adding images to you views, check the img helper 
 here

 http://www.web2py.com/books/default/chapter/29/05




-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Image in web2py/MongoDB based blog

2013-03-27 Thread Alan Etkin


 Isn't there a way to put images using links from other storage websites in 
 the form? Because I'm not going to be the only administrating the site and 
 they won't know how to work with the thing in that first link


I think that you could use the new builtin wiki for allowing content 
management. You would still have to implement your own code for adding html 
with a wysiwyg, (I don't think it ships with the wiki feature). The wiki is 
also documented in the book here

http://www.web2py.com/books/default/chapter/29/03?search=auth.wiki#The-built-in-web2py-wiki

On the othe hand, If you plan to use a classic cms (i.e. letting users add 
and modify their own text and different media types), there are various 
ready to use apps that do it for you. If you type cms in the group search 
box, you'll find a lot of useful information on those apps. Two of them are 
Instant Press and Movuca (although Movuca is intended as a complete social 
network rather than a simple content management application). Also, there's 
a new web2py cms project recently announced in this group.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Image in web2py/MongoDB based blog

2013-03-26 Thread Hugo Costa
Hi!

So, I'm setting up a website where there will be a blog system where I can 
create my news using a simple form and store that in a mongo database, but 
I want to know how can I put an image/video in the text making them appear 
in the view of the user.

I tried using with HTML code but it didn't work.

Can any one gimme a hand on this?

Thanks,

Hugo

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Image in web2py/MongoDB based blog

2013-03-26 Thread Alan Etkin
 but I want to know how can I put an image/video in the text making them 
appear in the view of the user.
 I tried using with HTML code but it didn't work.

Where will the images come from?

Will you store image files in you app folder?

Here is a guide to handle images from the book:

http://www.web2py.com/books/default/chapter/29/03#An-image-blog

If you just need a way of adding images to you views, check the img helper 
here

http://www.web2py.com/books/default/chapter/29/05


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Mongodb error in appadmin

2013-03-21 Thread Mike Veltman
The action I have a table/collection with 3 objects

In the table this is reverenced as

 Field('host_id', mdb.hoststable,
  comment=Like nim or hmc server.,
  label=T('Destination Host ID')),

But when in appadmin I select a other object to change then it throws a
error.

The error


  Ticket ID

127.0.0.1.2013-03-21.15-46-39.9f2786b5-d69c-4e31-a6c9-dd76f3692e59


type 'exceptions.RuntimeError' uncaught exception when
updating rows: MongoDB can only handle up to 8-byte ints


  Version

web2py^(TM) Version 2.4.5-stable+timestamp.2013.03.18.22.46.22
Python  Python 2.7.3: /usr/bin/python2.7 (prefix: /usr)


  Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.



Traceback (most recent call last):
  File 
/home/mv1965/Documents/development/eclipse/workspacejuno/w2pdeploy/gluon/restricted.py,
 line 212, in restricted
exec ccode in environment
  File 
/home/mv1965/Documents/development/eclipse/workspacejuno/w2pdeploy/applications/adeploy/compiled/controllers_appadmin_update.py,
 line 410, in module
  File 
/home/mv1965/Documents/development/eclipse/workspacejuno/w2pdeploy/gluon/globals.py,
 line 194, in lambda
self._caller = lambda f: f()
  File 
/home/mv1965/Documents/development/eclipse/workspacejuno/w2pdeploy/applications/adeploy/compiled/controllers_appadmin_update.py,
 line 277, in update
  File 
/home/mv1965/Documents/development/eclipse/workspacejuno/w2pdeploy/gluon/sqlhtml.py,
 line 1527, in accepts
self.id_field_name]).update(**fields)
  File 
/home/mv1965/Documents/development/eclipse/workspacejuno/w2pdeploy/gluon/dal.py,
 line 9834, in update
ret = db._adapter.update(tablename,self.query,fields)
  File 
/home/mv1965/Documents/development/eclipse/workspacejuno/w2pdeploy/gluon/dal.py,
 line 5450, in update
raise RuntimeError(uncaught exception when updating rows: %s % e)
RuntimeError: uncaught exception when updating rows: MongoDB can only handle up 
to 8-byte ints


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Mongodb error in appadmin

2013-03-21 Thread Mike Veltman

Created the following table

mdb.define_table('syscommands',

Field('commandname', type='string',
  unique=True,
  label=T('Commandname')),
Field('commandline', type='string',
  label=T('Command')),
Field('host_id', mdb.hoststable,
  comment=Like nim or hmc server.,
  label=T('Destination Host ID')),
Field('description', type='string',
  label=T('Description')),
Field('fase','string',
  comment=Fase 1 is storage, Fase 2 is Profile Creation, Fase 3
is VIO deployment, Fase 4 is Lpar deployment..,
  label=T('Fase')),
Field('created_on','datetime',default=request.now,
  label=T('Created On'),writable=False,readable=False),
Field('modified_on','datetime',default=request.now,
  label=T('Modified On'),writable=False,readable=False,
  update=request.now),
format='%(commandname)s',
migrate=settings.migrate)


# Table rules for command
mdb.syscommands.fase.requires = IS_IN_SET(['1', '2', '3', '4'])
#mdb.syscommands.host_id.requires = IS_NOT_EMPTY()
mdb.syscommands.commandname.requires = IS_NOT_EMPTY()
mdb.syscommands.host_id.requires = IS_IN_DB(mdb, 'hoststable.id',
'hoststable.hostname')
mdb.syscommands.commandline.requires = IS_NOT_EMPTY()


it revers to this table

mdb.define_table('hoststable',

Field('hostname', type='string',
  unique=True,
  label=T('Hostname')),
Field('description', type='string',
  label=T('Description')),
Field('netboot', type='string',
  label=T('Netboot information')),
Field('ip', type='string',
  default='192.168.1.x',
  label=T('IP Address')),
Field('connectcmd', type='string',
  default='ssh',
  label=T('Connection command')),
Field('useraccount', type='string',
  default='root',
  label=T('Default User')),
Field('created_on','datetime',default=request.now,
  label=T('Created On'),writable=False,readable=False),
Field('modified_on','datetime',default=request.now,
  label=T('Modified On'),writable=False,readable=False,
  update=request.now),
format='%(hostname)s',
migrate=settings.migrate)


# Table Hosts rules
mdb.hoststable.hostname.requires = IS_NOT_EMPTY()
mdb.hoststable.ip.requires = IS_NOT_EMPTY()


Then when I create a record in appadmin and after that change this item

It throws this error.


  Ticket ID

127.0.0.1.2013-03-21.17-03-38.3cfba30b-5706-4bdb-af50-faa6be3ed179


type 'exceptions.RuntimeError' uncaught exception when
updating rows: MongoDB can only handle up to 8-byte ints


  Version

web2py^(TM) Version 2.4.5-stable+timestamp.2013.03.18.22.46.22
Python  Python 2.7.3: /usr/bin/python2.7 (prefix: /usr)


  Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.



Traceback (most recent call last):
  File 
/home/mv1965/Documents/development/eclipse/workspacejuno/w2pdeploy/gluon/restricted.py,
 line 212, in restricted
exec ccode in environment
  File 
/home/mv1965/Documents/development/eclipse/workspacejuno/w2pdeploy/applications/adeploy/compiled/controllers_appadmin_update.py,
 line 410, in module
  File 
/home/mv1965/Documents/development/eclipse/workspacejuno/w2pdeploy/gluon/globals.py,
 line 194, in lambda
self._caller = lambda f: f()
  File 
/home/mv1965/Documents/development/eclipse/workspacejuno/w2pdeploy/applications/adeploy/compiled/controllers_appadmin_update.py,
 line 277, in update
  File 
/home/mv1965/Documents/development/eclipse/workspacejuno/w2pdeploy/gluon/sqlhtml.py,
 line 1527, in accepts
self.id_field_name]).update(**fields)
  File 
/home/mv1965/Documents/development/eclipse/workspacejuno/w2pdeploy/gluon/dal.py,
 line 9834, in update
ret = db._adapter.update(tablename,self.query,fields)
  File 
/home/mv1965/Documents/development/eclipse/workspacejuno/w2pdeploy/gluon/dal.py,
 line 5450, in update
raise RuntimeError(uncaught exception when updating rows: %s % e)
RuntimeError: uncaught exception when updating rows: MongoDB can only handle up 
to 8-byte ints



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Mongodb error in appadmin

2013-03-21 Thread Niphlod
seems to me that a lot of people are interested in using mongodb but really 
few are contributing back with tests and patches.

BTW: you DO know that Mongo generally doesn't play well with joins, right ? 
Using references in mongodb is not a smart design.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Mongodb error in appadmin

2013-03-21 Thread Mike Veltman

Op 21-03-13 17:50, Niphlod schreef:
 seems to me that a lot of people are interested in using mongodb but
 really few are contributing back with tests and patches.

 BTW: you DO know that Mongo generally doesn't play well with joins,
 right ? Using references in mongodb is not a smart design.


Mongodb as far as I know does not have joins :) But it did accept it, so
I decided to post the error.

But this is mysql database design that I did put over 1 on 1

I have to redo the database design to be nicer to Mongo (I am just
looking up to the conversion, even though I now have both databases so
its just a matter of writing a copy and past program after I created the
new database structure in mongo) .

I would love to have some pointers about how though define mongo in
db.py in a proper nosql way.

Thanks for the remark btw :) 

 -- 
  
 ---
 You received this message because you are subscribed to the Google
 Groups web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Mongodb error in appadmin

2013-03-21 Thread Alan Etkin


 I would love to have some pointers about how though define mongo in 
 db.py in a proper nosql way. 


Could you open an issue at the project page?

If you can, please provide:

- The relevant part of the model
- A possible set of data which would reproduce the error
- Your mongodb driver, database server, web2py and Python versions

The MongoDB DAL adapter does some automatic type mapping for id fields. I 
belive the issue could be realted to that.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Mongodb error in appadmin

2013-03-21 Thread Mike Veltman
On 03/21/2013 08:06 PM, Alan Etkin wrote:

 I would love to have some pointers about how though define mongo in
 db.py in a proper nosql way.


 Could you open an issue at the project page?


Done :-) Issue 1401
https://code.google.com/p/web2py/issues/detail?id=1401: Mongodb error
in appadmin If more info needed or some testing is needed just ask.

I will play with mongo and web2py anyway.


 If you can, please provide:

 - The relevant part of the model
 - A possible set of data which would reproduce the error
 - Your mongodb driver, database server, web2py and Python versions

 The MongoDB DAL adapter does some automatic type mapping for id
 fields. I belive the issue could be realted to that.

 -- 
  
 ---
 You received this message because you are subscribed to the Google
 Groups web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Mongodb and db.py

2012-12-17 Thread Mike Veltman
Hello People,

I am looking into converting my mysql database setup into a mongodb and
I was wondering about how at the moment db.py does translate the tables.
Because I would like to have some control/understanding about it.

-- 





[web2py] mongodb 2 errors: BSON can only handle up to 8-byte ints, second argument must be of type ObjectI

2012-10-23 Thread Adi
Installed mongodb, pymongo driver from source on mac osx 10.7.5, and 
created a fresh application. Tried to create a new user from admin panel, 
and got first error bellow. Record got inserted though. After I used option 
Lost password from the menu, got second error underneath. 

type 'exceptions.OverflowError' BSON can only handle up to 8-byte ints

Traceback (most recent call last):
  File /Users/adnan/web2py209/gluon/restricted.py, line 212, in restricted
exec ccode in environment
  File /Users/adnan/web2py209/applications/mango/controllers/default.py 
http://127.0.0.1:8000/admin/default/edit/mango/controllers/default.py, line 
77, in module
  File /Users/adnan/web2py209/gluon/globals.py, line 188, in lambda
self._caller = lambda f: f()
  File /Users/adnan/web2py209/applications/mango/controllers/default.py 
http://127.0.0.1:8000/admin/default/edit/mango/controllers/default.py, line 
39, in user
return dict(form=auth())
  File /Users/adnan/web2py209/gluon/tools.py, line 1235, in __call__
return getattr(self, args[0])()
  File /Users/adnan/web2py209/gluon/tools.py, line 2241, in register
self.add_membership(group_id, form.vars.id)
  File /Users/adnan/web2py209/gluon/tools.py, line 3035, in add_membership
record = membership(user_id=user_id, group_id=group_id)
  File /Users/adnan/web2py209/gluon/dal.py, line 7657, in __call__
return self._db(query).select(limitby=(0,1),for_update=for_update).first()
  File /Users/adnan/web2py209/gluon/dal.py, line 8788, in select
return adapter.select(self.query,fields,attributes)
  File /Users/adnan/web2py209/gluon/dal.py, line 5093, in select
for k,record in enumerate(mongo_list_dicts):
  File build/bdist.macosx-10.7-intel/egg/pymongo/cursor.py, line 799, in next
if len(self.__data) or self._refresh():
  File build/bdist.macosx-10.7-intel/egg/pymongo/cursor.py, line 750, in 
_refresh
self.__uuid_subtype))
  File build/bdist.macosx-10.7-intel/egg/pymongo/message.py, line 134, in 
query
encoded = bson.BSON.encode(query, False, uuid_subtype)
  File build/bdist.macosx-10.7-intel/egg/bson/__init__.py, line 566, in encode
return cls(_dict_to_bson(document, check_keys, uuid_subtype))
  File build/bdist.macosx-10.7-intel/egg/bson/__init__.py, line 475, in 
_dict_to_bson
elements.append(_element_to_bson(key, value, check_keys, uuid_subtype))
  File build/bdist.macosx-10.7-intel/egg/bson/__init__.py, line 426, in 
_element_to_bson
raise OverflowError(BSON can only handle up to 8-byte ints)
OverflowError: BSON can only handle up to 8-byte ints


Frames 
   
   -  
   
   *File /Users/adnan/web2py209/gluon/restricted.py in restricted at line 
   212* code arguments variables 
-  
   
   *File /Users/adnan/web2py209/applications/mango/controllers/default.py 
   in module at line 77* code arguments variables 
-  
   
   *File /Users/adnan/web2py209/gluon/globals.py in lambda at line 188* 
   code arguments variables 
-  
   
   *File /Users/adnan/web2py209/applications/mango/controllers/default.py 
   in user at line 39* code arguments variables 
-  
   
   *File /Users/adnan/web2py209/gluon/tools.py in __call__ at line 1235* 
   code arguments variables 
-  
   
   *File /Users/adnan/web2py209/gluon/tools.py in register at line 2241* 
   code arguments variables 
-  
   
   *File /Users/adnan/web2py209/gluon/tools.py in add_membership at line 
   3035* code arguments variables 
-  
   
   *File /Users/adnan/web2py209/gluon/dal.py in __call__ at line 7657* code 
   arguments variables 
-  
   
   *File /Users/adnan/web2py209/gluon/dal.py in select at line 8788* code 
   arguments variables 
-  
   
   *File /Users/adnan/web2py209/gluon/dal.py in select at line 5093* code 
   arguments variables 
-  
   
   *File 
   /Users/adnan/web2py209/build/bdist.macosx-10.7-intel/egg/pymongo/cursor.py 
   in next at line 799* code arguments variables 
-  
   
   *File 
   /Users/adnan/web2py209/build/bdist.macosx-10.7-intel/egg/pymongo/cursor.py 
   in _refresh at line 750* code arguments variables 
-  
   
   *File 
   /Users/adnan/web2py209/build/bdist.macosx-10.7-intel/egg/pymongo/message.py 
   in query at line 134* code arguments variables 
-  
   
   *File 
   /Users/adnan/web2py209/build/bdist.macosx-10.7-intel/egg/bson/__init__.py 
   in encode at line 566* code arguments variables 
-  
   
   *File 
   /Users/adnan/web2py209/build/bdist.macosx-10.7-intel/egg/bson/__init__.py 
   in _dict_to_bson at line 475* code arguments variables 
-  
   
   *File 
   /Users/adnan/web2py209/build/bdist.macosx-10.7-intel/egg/bson/__init__.py 
   in _element_to_bson at line 426* code arguments variables 
Function argument list 
   
   (key='group_id', value=24921443489256489473621663847L, check_keys=False, 
   uuid_subtype=3)
Code listing 
   
   421.
   422.
   423.
   424.
   425.
   426.
   
   427.
   428.
   429.
   430.
   
   return BSONINT + name + 

[web2py] mongodb error

2012-09-30 Thread Jose Galvez
I am trying to run through the image blog example from the docs using 
mongodb. when I try to upload an image I get the follwoing error 
class 'bson.errors.InvalidStringData' strings in documents must be valid 
UTF-8 and when I look at crated document: 
(self=Collection(Database(Connection('localhost', 27017), u'db1'), 
u'image'), doc_or_docs={'_id': ObjectId('5067ae9955a5d848e00be9b4'), 
'file': u'image.file.946df6ec3010e611.6772696c6c2e6a7067.jpg', 'file_blob': 
'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00C\x00\x08\x06\x06\x07\x06\x05\x08\x07\x07\x07\t\t\x08\n\x0c\x14\r\x0c\x0b\x0b\x0c\x19\x12...E\x14\x00QE\x14\x00QE\x14\x00QE\x14\x00QE\x14\x00QE\x14\x00QE\x14\x00QE\x14\x00QE\x14\x00QE\x14\x00QE\x14\x00QE\x14\x01\xff\xd9',
 
'title': u'redneck gril'}, manipulate=True, safe=True, check_keys=True, 
continue_on_error=False, **kwargs={})


it looks like it is not properly encoding the file_blob object.


Any suggestions on how to fix this?

-- 





[web2py] MongoDB Virtual Fields

2012-06-14 Thread stu
I just started using web2py and am using it with mongodb.  There have been 
a few hiccups along the way that seem related to the relative immaturity of 
the DAL for mongo.  I am scratching my head over trying to use virtual 
fields and am now wondering if this could be related to the same thing.

db.py:
db.define_table('dealers',
Field('name', type='string', notnull=True,label=T('Dealer Name')),
Field('contacts'),
Field('timezone')
)


class DealerSummaryVirtualFields(object):
def new_field(self):
#for simplicity, i am just going to return a 1
return 1

controllers/default.py
def dealers():
rows=db(db.dealers).select(orderby=db.dealers.name)
rows.setvirtualfields(dealers=DealerSummaryVirtualFields())
print rows.colnames
return dict(dealers=rows)

When I do this, I do not see the new_field in the result.

I have also tried the other method before calling .select():
db.dealers.virtualfields.append(DealerSummaryVirtualFields())

Same basic result.

Is there something elementary that I am missing?  Or is this actually an 
issue?

Thanks




[web2py] Mongodb - ImportError: cannot import name son

2012-06-11 Thread Michael Freitas
I tried to setup a new application using the latest source code form trunk 
and mongodb.  I get the error pasted at the end when I try to register a 
new user in my app.  I tried changing the from pymongo import son to 
from bson import son in the dal.py with no luck.  I can import son from 
bson within the python shell.
 
I am running on mac osx lion (using macports python 2.6), pymonogo 2.2 
(macports), mongodb 2.0.6 (macports) and web2py (2, 0, 0, 
datetime.datetime(2012, 6, 9, 17, 47, 2), 'dev')

Traceback (most recent call last):
  File /Users/mfreitas/Downloads/web2py/gluon/restricted.py, line 205, in 
restricted
exec ccode in environment
  File 
/Users/mfreitas/Downloads/web2py/applications/mongotest/controllers/default.py
 http://127.0.0.1:8000/admin/default/edit/mongotest/controllers/default.py, 
line 14, in module
  File /Users/mfreitas/Downloads/web2py/gluon/globals.py, line 175, in 
lambda
self._caller = lambda f: f()
  File 
/Users/mfreitas/Downloads/web2py/applications/mongotest/controllers/default.py
 http://127.0.0.1:8000/admin/default/edit/mongotest/controllers/default.py, 
line 3, in user
def user(): return dict(form=auth())
  File /Users/mfreitas/Downloads/web2py/gluon/tools.py, line 1196, in __call__
return getattr(self,args[0])()
  File /Users/mfreitas/Downloads/web2py/gluon/tools.py, line 2027, in register
onvalidation=onvalidation,hideerror=self.settings.hideerror):
  File /Users/mfreitas/Downloads/web2py/gluon/sqlhtml.py, line 1130, in 
accepts
hideerror=hideerror,
  File /Users/mfreitas/Downloads/web2py/gluon/html.py, line 1862, in accepts
status = self._traverse(status,hideerror)
  File /Users/mfreitas/Downloads/web2py/gluon/html.py, line 790, in _traverse
newstatus = c._traverse(status,hideerror) and newstatus
  File /Users/mfreitas/Downloads/web2py/gluon/html.py, line 790, in _traverse
newstatus = c._traverse(status,hideerror) and newstatus
  File /Users/mfreitas/Downloads/web2py/gluon/html.py, line 790, in _traverse
newstatus = c._traverse(status,hideerror) and newstatus
  File /Users/mfreitas/Downloads/web2py/gluon/html.py, line 790, in _traverse
newstatus = c._traverse(status,hideerror) and newstatus
  File /Users/mfreitas/Downloads/web2py/gluon/html.py, line 797, in _traverse
newstatus = self._validate()
  File /Users/mfreitas/Downloads/web2py/gluon/html.py, line 1620, in _validate
(value, errors) = validator(value)
  File /Users/mfreitas/Downloads/web2py/gluon/validators.py, line 552, in 
__call__
rows = self.dbset(field == value, ignore_common_filters = 
self.ignore_common_filters).select(limitby=(0, 1))
  File /Users/mfreitas/Downloads/web2py/gluon/dal.py, line 8147, in select
fields = adapter.expand_all(fields, adapter.tables(self.query))
  File /Users/mfreitas/Downloads/web2py/gluon/dal.py, line 4629, in select
mongosort_list, limitby_limit, limitby_skip = \
  File /Users/mfreitas/Downloads/web2py/gluon/dal.py, line 4574, in _select
ImportError: cannot import name son





[web2py] MongoDB 'document' or 'dict' filetype

2012-05-21 Thread Francisco Costa
At the moment MongodbAdapter only has these filetypes

class MongoDBAdapter(NoSQLAdapter):
uploads_in_blob = True

types = {
'boolean': bool,
'string': str,
'text': str,
'password': str,
'blob': str,
'upload': str,
'integer': long,
'bigint': long,
'float': float,
'double': float,
'date': datetime.date,
'time': datetime.time,
'datetime': datetime.datetime,
'id': long,
'reference': long,
'list:string': list,
'list:integer': list,
'list:reference': list,
}


Which means that if you want to insert or manage this:

{
field1: super,
field2: 300,
field3: [one, two, three],
field4 = {foo: bar, michael: jordan}
}

You can't do it for *field4*

Most MongoDB Collections do make use of document/dict datatype so this 
should be possible!


Re: [web2py] MongoDB table definitions

2012-05-21 Thread Francisco Costa
requested here: 
https://groups.google.com/d/topic/web2py/pqdYpUbMXKQ/discussion

On Wednesday, March 7, 2012 7:10:28 PM UTC, rdodev wrote:

 Bruno,

 Yes, it would seem that the only two options right now would be to 
 implement a document type (which I'm not sure how time consuming that would 
 be), or normalize that table and extract that dictionary/document into its 
 own table -- which could be annoying since I have several tables like that. 
 Thx for input.

 Best,
 Ruben

 On Wednesday, March 7, 2012 2:03:25 PM UTC-5, rochacbruno wrote:

 This is the Mongo Adapter types definition, I see no type 'dict' maybe it 
 needs a new type document'.

 class MongoDBAdapter(NoSQLAdapter):
 uploads_in_blob = True

 types = {
 'boolean': bool,
 'string': str,
 'text': str,
 'password': str,
 'blob': str,
 'upload': str,
 'integer': long,
 'double': float,
 'date': datetime.date,
 'time': datetime.time,
 'datetime': datetime.datetime,
 'id': long,
 'reference': long,
 'list:string': list,
 'list:integer': list,
 'list:reference': list,
 }




 On Wed, Mar 7, 2012 at 3:51 PM, rdodev ruben.or...@infotechfl.comwrote:

 Folks,

 I'm trying to define a mongo table in db.py that looks something like 
 this:

 {
   field1 : super,
   field2 : super,
   things = { this : stuff, that = stuff },
   field3 : Give me a call
 }

 defining fields1-3 is easy, but what's the syntax to build 'things' 
 which itself is a dictionary (see above)? Your help is much appreciated.




 -- 

 Bruno Rocha
 [http://rochacbruno.com.br]


On Wednesday, March 7, 2012 7:10:28 PM UTC, rdodev wrote:

 Bruno,

 Yes, it would seem that the only two options right now would be to 
 implement a document type (which I'm not sure how time consuming that would 
 be), or normalize that table and extract that dictionary/document into its 
 own table -- which could be annoying since I have several tables like that. 
 Thx for input.

 Best,
 Ruben

 On Wednesday, March 7, 2012 2:03:25 PM UTC-5, rochacbruno wrote:

 This is the Mongo Adapter types definition, I see no type 'dict' maybe it 
 needs a new type document'.

 class MongoDBAdapter(NoSQLAdapter):
 uploads_in_blob = True

 types = {
 'boolean': bool,
 'string': str,
 'text': str,
 'password': str,
 'blob': str,
 'upload': str,
 'integer': long,
 'double': float,
 'date': datetime.date,
 'time': datetime.time,
 'datetime': datetime.datetime,
 'id': long,
 'reference': long,
 'list:string': list,
 'list:integer': list,
 'list:reference': list,
 }




 On Wed, Mar 7, 2012 at 3:51 PM, rdodev ruben.or...@infotechfl.comwrote:

 Folks,

 I'm trying to define a mongo table in db.py that looks something like 
 this:

 {
   field1 : super,
   field2 : super,
   things = { this : stuff, that = stuff },
   field3 : Give me a call
 }

 defining fields1-3 is easy, but what's the syntax to build 'things' 
 which itself is a dictionary (see above)? Your help is much appreciated.




 -- 

 Bruno Rocha
 [http://rochacbruno.com.br]



[web2py] MongoDb Adapter issues

2012-05-17 Thread Krzysztof Mulica
Hello,
I'm having issues with the mongo adapter doing selects (using latest code 
from git.)

The initial issue i ran into was not being able to import SON in dal.py (i 
changed from pymongo to from bson and that fixed that)

After that I ran into issues with pymongo.objectid, after a little research 
I found this
http://api.mongodb.org/python/2.0/api/pymongo/objectid.html

references to pymongo.objectid should be replaced in favor of bson.objectid
when i did that in my local, everything started to work

-Kris



[web2py] MongoDB Adapter error in select

2012-05-07 Thread Francisco Costa
So I have this:

import sys
import time
from gluon.dal import DAL, Field
mongo = DAL('mongodb://localhost:27017/tymr')
mongo.define_table('user',
 Field('name', 'text'),
 Field('age',  'integer'),
 Field('city', 'string')
 )

def insert_users():
mongo.user.insert(name='John', age=66, city='Toronto')
mongo.user.insert(name='Mark', age=43, city='Boston')
mongo.user.insert(name='Tom',  age=43, city='Detroit')
mongo.user.insert(name='Jim',  age=18, city='Detroit')
mongo.user.insert(name='Jack', age=18)
mongo.user.insert(name='Eric', city='Boston')
return 'users in database'

def find_users():
users = mongo(mongo.user.age==66).select()
return dict(users=users)


after I run *insert_users* I check in MongoDb via terminal and everything 
is correct:
 db.user.find()
{ _id : ObjectId(4fa80feea34feb34f800), city : Toronto, age : 
NumberLong(66), name : John }
{ _id : ObjectId(4fa80feea34feb34f801), city : Boston, age : 
NumberLong(43), name : Mark }
{ _id : ObjectId(4fa80feea34feb34f802), city : Detroit, age : 
NumberLong(43), name : Tom }
{ _id : ObjectId(4fa80feea34feb34f803), city : Detroit, age : 
NumberLong(18), name : Jim }
{ _id : ObjectId(4fa80feea34feb34f804), age : NumberLong(18), 
name : Jack }
{ _id : ObjectId(4fa80feea34feb34f805), city : Boston, name : 
Eric }

but when I run *find_users* I get this error:

  File /opt/web2py/gluon/dal.py, line 7578, in select
return adapter.select(self.query,fields,attributes)
  File /opt/web2py/gluon/dal.py, line 4290, in select
return self.parse(rows,fields,mongofields_dict.keys(),False)
  File /opt/web2py/gluon/dal.py, line 1600, in parse
self.parse_value(value, fields[j].type,blob_decode)
  File /opt/web2py/gluon/dal.py, line 1496, in parse_value
return self.parsemap[key](value,field_type)
  File /opt/web2py/gluon/dal.py, line 1562, in parse_id
return int(value)
ValueError: invalid literal for int() with base 10: 'Toronto'




[web2py] mongodb adapter not working

2012-03-07 Thread rdodev
I'm running the nightly build of web2py, python 2.7, have pymongo installed 
and mongodb is running. in db,py I tried DAL('mongodb://127.0.0.1:[port 
number]/[dbname]') and keeps bombing with error: Uriparser for mongodb is 
not available is there another dependency other than pymongo? Please 
advice.

[web2py] MongoDB table definitions

2012-03-07 Thread rdodev
Folks,

I'm trying to define a mongo table in db.py that looks something like this:

{
  field1 : super,
  field2 : super,
  things = { this : stuff, that = stuff },
  field3 : Give me a call
}

defining fields1-3 is easy, but what's the syntax to build 'things' which 
itself is a dictionary (see above)? Your help is much appreciated.


Re: [web2py] MongoDB table definitions

2012-03-07 Thread Bruno Rocha
This is the Mongo Adapter types definition, I see no type 'dict' maybe it
needs a new type document'.

class MongoDBAdapter(NoSQLAdapter):
uploads_in_blob = True

types = {
'boolean': bool,
'string': str,
'text': str,
'password': str,
'blob': str,
'upload': str,
'integer': long,
'double': float,
'date': datetime.date,
'time': datetime.time,
'datetime': datetime.datetime,
'id': long,
'reference': long,
'list:string': list,
'list:integer': list,
'list:reference': list,
}




On Wed, Mar 7, 2012 at 3:51 PM, rdodev ruben.or...@infotechfl.com wrote:

 Folks,

 I'm trying to define a mongo table in db.py that looks something like this:

 {
   field1 : super,
   field2 : super,
   things = { this : stuff, that = stuff },
   field3 : Give me a call
 }

 defining fields1-3 is easy, but what's the syntax to build 'things' which
 itself is a dictionary (see above)? Your help is much appreciated.




-- 

Bruno Rocha
[http://rochacbruno.com.br]


[web2py] mongodb and web2py

2011-12-03 Thread Paul
Hi All,

Since I'm interested in python, web2py and recently mongodb and after
seeing breedvel...@gmail.com post 
http://code.google.com/p/web2py/issues/detail?id=497
to get inserts on the MongoDBAdapter working I've been hacking the
MongoDBAdapter code further to get select (and,or,eq,gt,lt,le,ge,ne
including orderby attribute), count, update and delete, drop and
truncate working. The code is very much a hack, is only going to work
for a subset of the available field types etc, as I'm still learning
the dal code and had issues around the dal using 'id' as a primary key
and mongodb using '_id' of type objectid, pymongo's required syntax
etc.. Let me know where to post the code/changes so others can check
this out, I'm not sure if Massimo still had any plans to implement
this adapter?

Thanks

Paul


RE: [web2py] mongodb and web2py

2011-12-03 Thread Mark Breedveld
I have also been working on the select matter, so maybe it would be wise to
cooperate?
I can add you to my dropbox and we can work together?

Regards Mark
-Oorspronkelijk bericht-
Van: web2py@googlegroups.com [mailto:web2py@googlegroups.com] Namens Paul
Verzonden: zaterdag 3 december 2011 12:03
Aan: web2py-users
Onderwerp: [web2py] mongodb and web2py

Hi All,

Since I'm interested in python, web2py and recently mongodb and after seeing
breedvel...@gmail.com post
http://code.google.com/p/web2py/issues/detail?id=497
to get inserts on the MongoDBAdapter working I've been hacking the
MongoDBAdapter code further to get select (and,or,eq,gt,lt,le,ge,ne
including orderby attribute), count, update and delete, drop and truncate
working. The code is very much a hack, is only going to work for a subset of
the available field types etc, as I'm still learning the dal code and had
issues around the dal using 'id' as a primary key and mongodb using '_id' of
type objectid, pymongo's required syntax etc.. Let me know where to post the
code/changes so others can check this out, I'm not sure if Massimo still had
any plans to implement this adapter?

Thanks

Paul

-
Geen virus gevonden in dit bericht.
Gecontroleerd door AVG - www.avg.com
Versie: 2012.0.1873 / Virusdatabase: 2102/4653 - datum van uitgifte:
12/02/11



Re: [web2py] mongodb and web2py

2011-12-03 Thread Vasile Ermicioi
my advice is to pay attention to another document and graph database:
orientdb
http://code.google.com/p/orient/

like mongodb it is a document database, which means it can store json like
objects
and because it supports some sort of sql it should be much easier to write
an adapter


[web2py] Mongodb - inserts working-but some comments on the code are welcome

2011-11-09 Thread Mark Breedveld
Hi, MongoDB users

 

I currently working on the mongoDB adapter, but I need some feed back.

http://code.google.com/p/web2py/issues/list

Issue 497,499 and 500 will make the inserts in mongodb possible.

But I'm from origin a C# programmer and not used to programming in python.

So maybe that some of the solutions I propose need to be written a bit
different.

 

I have seen a few testers here, so comments are welcome.

 

Mark Breedveld,

Student at University of Rotterdam,



[web2py] MongoDB testing and development

2011-10-21 Thread Mark Breedveld
Dear Massimo,

I downloaded the trunk and I am currently testing the MongoDB Adapter
and I can tell that inserting currently isn't working. Also the
creation of tables doesn't work.

First question, shall I put the bugs and improvements that I find in
the Issue list or just in this discussion?

Secondly, the create_table method, is it possible to just skip the
function with a pass command? Cause collection in mongodb are created
on first insert of an document. There are capped collections in
MongoDB which offer better performance, but there data size is fixed.
My advise would be that by default the model is just passed(if not
needed somewhere else in web2py) and we could later implement the
capped collections. Because I want to have the adapter working first.

def create_table(self, table, migrate=True, fake_migrate=False,
polymodel=None):
pass
#May capped collection here? 
http://www.mongodb.org/display/DOCS/Capped+Collections
#because pymongo create collection on first insert (inserting a
document) http://api.mongodb.org/python/2.0/tutorial.html

Regards Mark,


Re: [web2py] MongoDB and Web2py

2011-10-03 Thread ~redShadow~
On Sun, 2011-10-02 at 14:52 -0700, Francisco Costa wrote: 
 I don't want to spam the group about this, but I would like to have
 some official incites about when will the DAL have a MongoDB Adapter.
 
 
 Since this is the most requested feature by the web2py community
 http://web2py.uservoice.com/forums/42577-general are there any plans
 or schedule for this support?

I am using pymongo directly in some experiments, but I'd prefer it to be
integrated directly in the DAL. I was trying to extend the actual
adapter by monkeypatching that, but I found quite hard to write that due
to the lack of documentation on what adapters should do exactly (am I
wrong? There's some doc that I wasn't able to find?).

Anyways, I'd need MongoDBAdapter working for a project, so I'm willingly
to cooperate in writing and testing that, I'm just a bit stuck trying to
understand how adapters should work, by reading the source code of other
adapters..

-- 
Samuele ~redShadow~ Santi

 redshadow[at]hackzine.org - redshadowhack[at]gmail.com

  Blog: http://hackzine.org

  GPG Key signature:
   050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933

/me recommends:
Squadra Informatica - http://www.squadrainformatica.com

 - Proud ThinkPad T-Series owner
 - Registered Linux-User: #440008
  * GENTOO User since 1199142000 (2008-01-01)
  * former DEBIAN SID user

  Software is like sex: it's better when it's free!
  -- Linus Torvalds



signature.asc
Description: This is a digitally signed message part


[web2py] MongoDB and Web2py

2011-10-02 Thread Francisco Costa
I don't want to spam the group about this, but I would like to have
some official incites about when will the DAL have a MongoDB Adapter.


Since this is the most requested feature by the web2py community
http://web2py.uservoice.com/forums/42577-general are there any plans
or schedule for this support?


[web2py] MongoDB supported by DAL

2011-07-25 Thread Francisco Costa
When will MongoDBAdapter finalize so we can use it with DAL?


[web2py] MongoDB and Web2Py

2011-03-31 Thread luckysmack
I have read a few older messages about mongoDB being made to work with
the DAL. But they all seem to be pretty dated and have not specified
what was working and what wasnt. massimo menitoned that it may be
ready by january of this year. But under the supported list it wasnt
listed. So im just curious as to what the status of using mongoDB is
with web2py and if anyone has a basic example on how I would use it.
Thanks


[web2py] MongoDB and Web2Py: global variables / session problem

2011-02-05 Thread marcovic
Hi guys,
I'm trying to build a simple web app where you can upload a file into
MongoDB (using GridFS) and then get the file with one-click.

This is my model:

Model: mongo.py
---
from pymongo import Connection
from gridfs import GridFS

class MongoInterface:

Initialize MongoDB connection.

def __init__(self):
global fs
connection = Connection('localhost', 27017)
db = connection.mydb
db.authenticate(myuser,mypasswd)
fs = GridFS(db)


def uploadFile(self,filename,data):
b = fs.put(data, filename=filename)
out = fs.get(b)
return out

def getFile(self,filename):
b = fs.get_last_version(filename)
return b

def getList(self):
out = fs.list()
return out

and in default controller, i wrote my methods:

Controller: default.py
--
...

def upload():
global mongoId
mongoId = MongoInterface()
session.myid = mongoId
Get file name
c = request.vars.uploadFile.filename
Get binary file
file=request.vars.uploadFile.file
Upload file into GridFS
file_id = mongoId.uploadFile(c,file)
file_name = file_id.filename
file_name = mongoId.getList()
return dict(message=file_name)

def getmongofile():
global mongoId
c = request.args
mongoId = session.myid
file = mongoId.getMongoFile(c)

...

Now what happen? Upload files works as well as getting a list of all
uploaded files but when I try to get one of the files, I got this
error:

  file = mongoId.getMongoFile(c)
AttributeError: 'NoneType' object has no attribute 'getMongoFile'

I see that here I have some problems with global variable because it
seems that it doesn't recognize mongoId descriptor. What I paste here
is only the last of a long list of tests that I've done (using global
doesn't work I read somewhere in the Web...). How can I maintain my
connection id through different http request in order to instantiate
my MongoDB just one time?

Many thanks in advance for every suggestions,

marcovic


[web2py] mongoDb

2010-11-25 Thread Aurigadl
In my projects I'm using MongoDB
I need to work with this tool
you need this to work with web2py? Make controller for this
RDBMS or or this tool work wiht this


Re: [web2py] mongoDb

2010-11-25 Thread Bruno Rocha
I am using PyMongo for one project
http://api.mongodb.org/python/1.9%2B/index.html

I put the libs in modules and created some methods in my /models to abstract
commom tasks, PyMongo is very simple, so it is easy to access the data
directly form controllers or views using its API.

2010/11/25 Aurigadl aurig...@gmail.com

 In my projects I'm using MongoDB
 I need to work with this tool
 you need this to work with web2py? Make controller for this
 RDBMS or or this tool work wiht this




-- 

Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] MongoDb and web2py

2010-07-31 Thread Amit Ambardekar
I want to use web2py with pymongo.
I don't need ORM or or anything. I just want to connect use pymongo
from Web2Py.
How can I use it inside web2py. I need it for high performance use.

Amit