I've just upgraded to 0.3.7, and when the combined table/column name
is at least 30 characters I get an error from the mapper like this:
sqlalchemy.exceptions.NoSuchColumnError: "Could not locate column in
row for column 'Column(u'EventLastCancellationDate',MSDate())'"
Is this a problem with the changes in 0.3.7 ?
I'm using pymssql 0.8.0 with SQL server 2000.
Thanks,
Graham
SELECT [T_Event].[EventLastCancellationDate] AS
[T_Event_EventLastCancell_8ab9]
whereas 0.3.7 generates
[T_Event].[EventLastCancellationDate] AS
[T_Event_EventLastCancellationDate]
>From what I can find, column names can be up to 128 chars in SQL
server, but maybe pymssql is truncating at 30?
Graham
so this seems to be something happening with the DBAPI itself. if
you want to do us a favor and attempt your query with the raw DBAPI,
and then look at cursor.description, we can confirm that it is
truncating to 30 characters and we can place this number within the
corresponding dialect so that both sides agree.
if it is the case that MS-SQL overall has a 30 character restriction
you might want to consider shortening your column names.
>
> To add a little more info, 0.3.6 generates:
>
> SELECT [T_Event].[EventLastCancellationDate] AS
> [T_Event_EventLastCancell_8ab9]
>
> whereas 0.3.7 generates
>
> [T_Event].[EventLastCancellationDate] AS
> [T_Event_EventLastCancellationDate]
>
>> From what I can find, column names can be up to 128 chars in SQL
> server, but maybe pymssql is truncating at 30?
>
if its the case that MS-SQL allows 128-character column names, but
only 30 character label names, that would be unfortunate. i might
have to rewrite the whole label-truncation code (since it cant
currently differentiate between physical column names and label names).
> The label-truncation code is fine. The issue isn't SA. It's the
> DBAPI that pymssql rides on top of...identifier limit is 30 chars,
> is deprecated by Microsoft, it will never be fixed.
>
> Try pyodbc, which has no such limitation.
>
OK well, we should put the 30-char limit into pymssql's dialect.
however, the way the truncation works right now, its going to chop
off all the column names too...which means unless i fix that, pymssql
cant be used with any columns over 30 chars in size.
> def max_identifier_length(self):
> return 30
to the pymssql dialect.
I also find that I need to set has_sane_rowcount=False (as I have had
to with every release).
Is anyone else using pymssql? Do you have the same problems? Should
these changes be made on the trunk?
Thanks,
Graham
On May 1, 7:13 pm, Michael Bayer <mike...@zzzcomputing.com> wrote:
> it is max_identifier_length() on Dialect.
>
> ive also gone and figured out why it is hard to separate the max
> length of columns vs. that of labels...its because of some issues
> that arise with some auto-labeling that happens inside of
> ansisql.py....so its fortunate i dont have to get into that.
>
> On May 1, 2007, at 12:57 PM, Rick Morrison wrote:
>
> > The underlying DBlib limits *all* identifier names, including
> > column names to 30 chars anyway, so no issue there.
>
> > Where does the character limit go in the dialect? Can I follow
> > Oracle as an example?
>
I still have rowcount issues on the latest svn. Also, is 'money' a
native type? I'm currently setting
ischema_names['money'] = MSNumeric
Thanks,
Graham
Hi All,
I'm a bit late to this discussion but I've just run into this problem
so it's still out there. I found a way round for now by using
'include_properties = ...' and only using the (fortunately short
named) columns that I need, but this could be a real pain. I'm using
python-sqlalchemy-0.4.2 and pymssql-0.8.0. Is this a problem with
pymssql or sqlalchemy - I couldn't work it out from the previous post.
It looks like I have to edit pymssql.
Anyway, I'm just glad to find out it's not just me with this problem.
sqlalchemy has been great to use so far (apart from this).