Hi Terrence,
I have tried it your way now and for me a record is inserted. See results
below.
C:\Users\edwinh\Documents\web2py\gluon\packages\dal>python -i
Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import db
>>> db.grid.insert(market='asdfasdf', pickle='asdfasfd')
1L
>>>
Regards, Edwin
On Tuesday, February 14, 2017 at 2:56:17 AM UTC+4, Terrence Brannon wrote:
>
> Hi Edwin, I should've stated that I am using pyDAL standalone. And please
> note that I did an `import db` at the top of the console session, which
> should've run all the define_table statements in that file, correct?
>
> On Monday, February 13, 2017 at 2:36:03 PM UTC-5, Edwin Haver wrote:
>>
>> Hi Terrence,
>>
>> Your db.py script has not run and this is why you get the no such table
>> error. I believe that it should work if you run the following command:
>>
>> python web2py.py -S <APPNAME>
>>
>> You will then get an interactive shell with the web2py environment and
>> application loaded.
>>
>> Regards, Edwin
>>
>> On Monday, February 13, 2017 at 10:34:52 PM UTC+4, Terrence Brannon wrote:
>>>
>>> Hello, I created the following RDBMS schema in the file db.py
>>>
>>> from pydal import DAL, Field
>>> from datetime import datetime
>>>
>>> db = DAL('sqlite://gridtrader.db')
>>>
>>> grid = db.define_table(
>>> 'grid',
>>> Field('market'),
>>> Field('pickle', type='text'),
>>> Field('timestamp', type='datetime', default=datetime.now)
>>> )
>>>
>>> # db.executesql('CREATE INDEX IF NOT EXISTS grid_market_idx ON grid
>>> (market);')
>>>
>>> db.commit()
>>>
>>> And then I attempted to insert a record but got this error:
>>>
>>> $ python -i
>>> Python 2.7.12 |Anaconda 4.2.0 (64-bit)| (default, Jun 29 2016, 11:07:13)
>>> [MSC v.1500 64 bit (AMD64)] on win32
>>> Type "help", "copyright", "credits" or "license" for more information.
>>> Anaconda is brought to you by Continuum Analytics.
>>> Please check out: http://continuum.io/thanks and https://anaconda.org
>>> >>> import db
>>> >>> db.grid.insert(market='asdfasdf', pickle='asdfasfd')
>>> Traceback (most recent call last):
>>> File "<stdin>", line 1, in <module>
>>> File
>>> "C:\Users\supreme\install\Anaconda2\lib\site-packages\pydal\objects.py",
>>> line 741, in insert
>>> ret = self._db._adapter.insert(self, self._listify(fields))
>>> File
>>> "C:\Users\supreme\install\Anaconda2\lib\site-packages\pydal\adapters\base.py",
>>>
>>> line 492, in insert
>>> raise e
>>> sqlite3.OperationalError: no such table: grid
>>> >>>
>>>
>>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.