string vs text db field question

27 views
Skip to first unread message

Vlad

unread,
Jun 4, 2019, 5:30:05 AM6/4/19
to web2py-users
I've used a string field to keep certain info, and it works just fine, but I've just noticed that the strings I ended up saving in this field were around 1,000 characters long, sometimes even closer to 2,000. 
According to the docs, the default limit for a string field is 512. The limit doesn't seem to be a problem now, so I am wondering what's the nature of the limit. Is it safe to use longer strings because DAL handles them somehow? Or I'm just lucky at the moment, and should increase the size or switch to a text field? (I am still developing, so using sqlite for the time being)

Anthony

unread,
Jun 4, 2019, 9:11:51 AM6/4/19
to web2py-users
SQLite doesn't make a distinction between string and text nor have a length limit, so yes, you're just "lucky" at the moment. If you plan to migrate to something like Postgres, either explicitly set a higher limit or just use a text field.

Anthony

Eliezer (Vlad) Tseytkin

unread,
Jun 4, 2019, 9:34:20 AM6/4/19
to web...@googlegroups.com
Everybody is lucky sometimes :)

Thank you! 

--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/D7E75GRRGlA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/adc52c5a-c85d-44da-8b18-fb67f12c7f42%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages