Red Gate forums :: View topic - Using other column value through Python script
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Data Generator 2
SQL Data Generator 2 forum

Using other column value through Python script

Search in SQL Data Generator 2 forum
Post new topic   Reply to topic
Jump to:  
Author Message
jean-rator



Joined: 02 Feb 2012
Posts: 13

PostPosted: Tue Mar 13, 2012 2:25 pm    Post subject: Using other column value through Python script Reply with quote

Hello everybody,


I'm trying to set a column (bit) with the opposite of another one (bit, too) of the same table.
when one is true, the other has to be false and vice-versa.

The only choice - in my opinion - is to use a Python script.

I'm not an expert of this language, and I'm wondering if it si possible to use the value of other column in my code (as it could be done with Regexp generator : $[columnName]...)

Constraint : it is not possible to use an SQL Statement because an additional connection has to be defined in that case ; and I want to target any server/DB with only changing the connection at Project level.


Thanks in advance for any suggestion/advice.
Regards.

JL.
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6586

PostPosted: Wed Mar 14, 2012 5:34 pm    Post subject: Reply with quote

Hello,

The Python generator won't give you access to generated data in other columns. There is an unsupported, third-party Ruby generator that you can use for this, discussed at http://www.simple-talk.com/dotnet/.net-framework/embedding-ironruby-and-the-dlr-into-sql-data-generator/

I have a newer build that works with SQL Data Generator v2; if you email me, I can send it to you so you don't have to mess around with the v1 version Ben did so long ago that is not working with the current build.
Back to top
View user's profile Send private message
cvillegas



Joined: 04 Apr 2012
Posts: 4

PostPosted: Wed Apr 04, 2012 6:53 pm    Post subject: Could you please post a link to the unsupported generator? Reply with quote

Could you please post a link to the unsupported generator?

Thanks!
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6586

PostPosted: Thu Apr 05, 2012 10:27 am    Post subject: Reply with quote

Fair enough! Here is an FTP link for the Ruby generator for SQL Data Generator 2.0.
ftp://support.red-gate.com/patches/sql_data_generator/SDGDLRGenerator_2.0.1.6.zip
Back to top
View user's profile Send private message
buddhatripp



Joined: 07 Dec 2012
Posts: 1

PostPosted: Fri Dec 07, 2012 4:52 pm    Post subject: Reply with quote

The Ruby Generator does not seem to work. It does not show as an option in the column generation settings. The old one shows up, but causes an error as expected. I just unzipped and put the files in the Generator directory then started the application... Am I doing something wrong? Thank you!
Back to top
View user's profile Send private message
sgehret



Joined: 07 Dec 2012
Posts: 7
Location: United States

PostPosted: Fri Dec 07, 2012 5:04 pm    Post subject: IronRuby and V2 Reply with quote

Hi, I downloaded the IronRuby generator for SQL Data Generator 2.0 that Brian posted. But I don't know how to get it to show in the tool. I am evaluating this tool and the version is 2.0.3.1. I unzipped the dll files and added them to the Generator directory. But Ruby is not an option anywhere within the application.
Back to top
View user's profile Send private message AIM Address
Brian Donahue



Joined: 23 Aug 2004
Posts: 6586

PostPosted: Mon Dec 10, 2012 10:12 am    Post subject: Reply with quote

The Ruby generator had to be rebuilt for every version of SDG, so I believe the DLL references need to be updated and the project recompiled. I think the source code is included, so you can do this. However, if you need me to look into it, I may be ~1-3 days before I can get to it.

Just to manage expectations, the Ruby Generator is unsupported and not a part of the SQL Data Generator software package. It's something I can do in my spare time.
Back to top
View user's profile Send private message
sgehret



Joined: 07 Dec 2012
Posts: 7
Location: United States

PostPosted: Mon Dec 10, 2012 8:39 pm    Post subject: Reply with quote

Hi Brian,

I don't think you need to spend any time on it unless you think it would benefit the SDG user community at large. We are going to purchase this tool anyway and I am done with my testing.

The source code was not in the zip file. Just the .dll files. As a company, I think we would be interested in getting a working version of IronRuby, though, because we really have big need to reference other fields in the same row. Right now, we are doing all that kind of work in After scripts.

Thanks,
Scott
Back to top
View user's profile Send private message AIM Address
Brian Donahue



Joined: 23 Aug 2004
Posts: 6586

PostPosted: Mon Dec 10, 2012 10:39 pm    Post subject: Reply with quote

I just uploaded a new build of the Iron Ruby generator for the latest version of SQL Data Generator (2.0.3.1):
ftp://support.red-gate.com/patches/sql_data_generator/sdgdlrgenerator_2.0.3.1.zip

The source code is available from the original Simple-Talk article:
http://www.simple-talk.com/dotnet/.net-framework/embedding-ironruby-and-the-dlr-into-sql-data-generator/

However, since Ben built this against an older version of MS DLR, I had to custom-build the older versions of MS-DLR, so if you wanted to recompile, you would have to replace references to the Microsoft.Scripting assemblies with the "Ruby" versions contained in the ZIP.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group