[pywin32-bugs] [ pywin32-Bugs-1203013 ] Python won't run correctly under MS DTS
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
|
From: SourceForge.net <no...@so...> - 2005-05-16 22:16:23
|
Bugs item #1203013, was opened at 2005-05-16 13:07 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1203013&group_id=78018 Category: com Group: None Status: Open Resolution: None Priority: 5 Submitted By: Carl Waldbieser (carl_waldbieser) Assigned to: Nobody/Anonymous (nobody) Summary: Python won't run correctly under MS DTS Initial Comment: Synopsis: Microsoft Data Transformation Services (DTS) is part of SQL Server 2000. It is essentially a framework that allows a user to transform data from a source (text file, Excel, database, etc.) to a destination. Part of the framework allows the user to employ an ActiveX Scripting language to perform the transformations. While I have been successful in using server other ActiveX Scripting languages (VBScript, JScript, ActivePerl) in this capacity, Python does not behave as expected. Environment: I am using Python 2.4 with the Win32 extensions installed and activated. I believe the build of the exetensions is 204 (the instaler file name is pywin32-204.win32-py2.4.exe). I am able to successfully instantiate COM objects with Python in stand alone programs, and server-side scripting with Python in an ASP environment behaves normally. Steps to reproduce: I created a new DTS package in SQL Server 2000, and entered Design Mode. I created a data source and a data destination (just a simple map from one table to another). I create a Transform Data Task from the source to the destination. In the Task properties dialog, on the Transformations tab, I created a transformation from one of the source columns to a destination column. I chose the type of transformation to be "ActiveX Script". In the properties dialog for the script, I set the Language drop-down to "Python". At this point, there are several noticable discrepencies from normal behavior. With any of the other languages (including Perl), the "Functions" dialog is populated. With Python, it is not. Also, if I exit and re-enter the dialog for any of the other languages, boilerplate transformation code is generated. For Python, there is no code. By trial and error, I was able to determine that the entry point for Python. However, objects made available to the other languages are inaccessible from python. The following code snippets in the four languages I mentioned should demonstrate the problem: #********************************************************************** # Perl Transformation Script #************************************************************************ # Copy each source column to the destination column sub Main() { $DTSDestination->Item("data")->{Value} = $DTSSource->Item("data_value")->{Value}; return 1; # DTSTransformStat_OK; } //********************************************************************** // Java Transformation Script //************************************************************************ // Copy each source column to the destination column function Main() { DTSDestination("data") = DTSSource("data_value"); return(DTSTransformStat_OK); } '********************************************************************** ' Visual Basic Transformation Script '************************************************************************ ' Copy each source column to the destination column Function Main() DTSDestination("data") = DTSSource("data_value") Main = DTSTransformStat_OK End Function ###################################################################### # Python transformation script # Not auto-generated. Commented line produces an error when # uncommented. ###################################################################### def Main(): #DTSDestination["data"] = DTSSource["data_value"] return 0 The error indicates that the DTSDestination and DTSSource names do not refer to any values at this point in the program. I can only hypothesise that these global values are not be exposed correctly, though I have no idea whether that is a problem with the DTS or the Python side of the Active Script engine. Seems to work OK for the other languages, which is what prompted me to report this bug. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1203013&group_id=78018 |