Re: NoSuchColumnError: "Could not locate column in row for column

629 views
Skip to first unread message

Mengu

unread,
Feb 13, 2013, 2:15:39 PM2/13/13
to TurboGears
have you set your database information in your config file and have
you created your database and tables? also, let us see your model.

On Feb 13, 11:22 am, Neil Ablang <neil.abl...@gmail.com> wrote:
> Hello,
>
> My turbogears application is working fine with paster serve.
>
> But when deployedto Apache Httpd, Im encountering the error:
> NoSuchColumnError: "Could not locate column in row for column
>
> Without database access there are no errors.
>
> What have I done wrong? I used the procedure to install turbogears as
> describe in turbogears main page.
>
> Error transcript provided below:
>
> Best Regards,
>
> Neil Ablang
>
> [Wed Feb 13 17:08:24 2013] [error] [client ]     stateList =
> DBSession.query(StateCountyRecDate).all()
> [Wed Feb 13 17:08:24 2013] [error] [client ]   File
> "/usr/local/turbogears/sorter/lib/python2.6/site-packages/SQLAlchemy-0.7.9- py2.6-linux-i686.egg/sqlalchemy/orm/query.py",
> line 2115, in all
> [Wed Feb 13 17:08:24 2013] [error] [client ]     return list(self)
> [Wed Feb 13 17:08:24 2013] [error] [client ]   File
> "/usr/local/turbogears/sorter/lib/python2.6/site-packages/SQLAlchemy-0.7.9- py2.6-linux-i686.egg/sqlalchemy/orm/query.py",
> line 2348, in instances
> [Wed Feb 13 17:08:24 2013] [error] [client ]     rows = [process[0](row,
> None) for row in fetch]
> [Wed Feb 13 17:08:24 2013] [error] [client ]   File
> "/usr/local/turbogears/sorter/lib/python2.6/site-packages/SQLAlchemy-0.7.9- py2.6-linux-i686.egg/sqlalchemy/orm/mapper.py",
> line 2029, in _instance
> [Wed Feb 13 17:08:24 2013] [error] [client ]     tuple([row[column] for
> column in pk_cols])
> [Wed Feb 13 17:08:24 2013] [error] [client ]   File
> "/usr/local/turbogears/sorter/lib/python2.6/site-packages/SQLAlchemy-0.7.9- py2.6-linux-i686.egg/sqlalchemy/engine/base.py",
> line 2834, in _key_fallback
> [Wed Feb 13 17:08:24 2013] [error] [client ]
> expression._string_or_unprintable(key))
> [Wed Feb 13 17:08:24 2013] [error] [client ] NoSuchColumnError: "Could not
> locate column in row for column 'StateCountyRecDate.record_id'"

Neil Ablang

unread,
Feb 13, 2013, 7:32:59 PM2/13/13
to turbo...@googlegroups.com
Hello,


here is my table from model folder. Its working on my paster serve setup. Yes the DB is created, The __init__.py  has also been updated to add the models below.

thanks in advance for any help.


# -*- coding: utf-8 -*-
"""Sample model module."""

from sqlalchemy import *
from sqlalchemy.orm import mapper, relation
from sqlalchemy import Table, ForeignKey, Column
from sqlalchemy.types import Integer, Unicode
#from sqlalchemy.orm import relation, backref

from sorter.model import DeclarativeBase, metadata, DBSession


class SortedFiles(DeclarativeBase):
    """Table for Sorted Files"""
    __tablename__ = "BNTSortedFiles"

    record_id = Column(Integer, primary_key=True)
    fileName = Column(String,nullable=True,unique=True)
    docTitle = Column(String,nullable=True)
    docTag = Column(String,nullable=True)
    docType = Column(String,nullable=True)
    recDate = Column(String,nullable=True)
    group = Column(String,nullable=True)
    jobName = Column(String,nullable=True)
    stateCounty = Column(String,nullable=True)
    ftpPath = Column(String,nullable=True)
    move = Column(Boolean,nullable=False,default='False')
    dispatch = Column(Boolean,nullable=False,default='False')
    done= Column(Boolean,nullable=False,default='False')

class StateCountyRecDate(DeclarativeBase):
    """Table for State County Recording Date"""
    __tablename__ = "StateCountyRecDate"
   
    record_id = Column(Integer, primary_key=True)
    recDate = Column(String,nullable=True)
    stateCounty = Column(String,nullable=True)
    dtaImgStatus = Column(Boolean,nullable=False,default='False')

Moritz Schlarb

unread,
Feb 14, 2013, 6:44:42 AM2/14/13
to turbo...@googlegroups.com
How do you configure mod_wsgi for Apache?
Which configuration file did you use there? development.init/deployment.ini_tmpl?
Which configuration file did you use to create the database - was sqlalchemy.uri the same?

Maybe post the relevant configuration files here (check for passwords, of course...).

Neil Ablang

unread,
Feb 14, 2013, 7:20:40 PM2/14/13
to turbo...@googlegroups.com
Hello,

The ini file is the same as that of paster. The DB uri is the same. When I run 'paster serve production.ini --daemon' , I have no errors.  When running under wsgi, the sqlalchemy error props up. For now, I am running my app using the paster daemon mode since the apache wsgi is spewing up that NoSuchColumnError.

sql URL :

sqlalchemy.url=postgresql://yyyyy:yy...@xxx.xxx.xxx.xx:5432/sorterDB


Best Regards,

Neil

Alessandro Molina

unread,
Feb 15, 2013, 4:47:48 AM2/15/13
to TurboGears .
If your database driver is using C extension you might need to configure mod_wsgi properly as otherwise it might have random failures due to subinterpreters creation.

You might want to try to configured mod_wsgi with WSGIApplicationGroup %{GLOBAL} and WSGIDaemonProcess+WSGIProcessGroup this makes sure that no subinterpreters are used and each python app is constrained to its own process space and interpreter.



--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email to turbogears+...@googlegroups.com.
To post to this group, send email to turbo...@googlegroups.com.
Visit this group at http://groups.google.com/group/turbogears?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Neil Ablang

unread,
Feb 16, 2013, 3:50:30 AM2/16/13
to turbo...@googlegroups.com
Hi Allessandro,

I tried adding the WSGIApplicationGroup %{GLOBAL}, and the WSGIDaemonProcees and WSGIProcessGroup has been in  my apache config since the start.

I have been using this WSGI config for pre- 2.2.2 version of turbogears and is working fine.

My config for apache virtual host is given below.

Many thanks for any help

Best Regards,

Neil
+++++++++++++++++++++Apache config+++++++++++++++++


WSGIPythonHome /usr/local/turbogears/sorter
# TODO: confirm that this line is appropriate for Daemon mode...
WSGIPythonPath /usr/local/turbogears/sorter/lib/python2.6/site-packages

NameVirtualHost *:9090

# This block configures our particular named virtual host
<VirtualHost *:9090>
#    ServerName xxx.xxx.xxx.xxx:9090
# Allow apache to serve static content.
# Your site is configured to mount at / (use --mount to change this)

Alias /images /usr/local/turbogears/sorter/sorter/sorter/public/images
Alias /css /usr/local/turbogears/sorter/sorter/sorter/public/css
Alias /javascript /usr/local/turbogears/sorter/sorter/sorter/public/javascript

# Choose deamon mode with 10 threads and 3 processes.
# For small to medium website.
WSGIDaemonProcess sorter threads=10 processes=3
WSGIApplicationGroup %{GLOBAL}
WSGIProcessGroup sorter
WSGIScriptAlias / /usr/local/turbogears/sorter/sorter/apache/sorter.wsgi

# Directory Permissions.
<Directory /usr/local/turbogears/sorter/sorter/apache>
Order deny,allow
Allow from all
</Directory>

</VirtualHost>
Reply all
Reply to author
Forward
0 new messages