Due to recent updates, all users are required to create an Altair One account to login to the RapidMiner community. Click the Register button to create your account using the same email that you have previously used to login to the RapidMiner community. This will ensure that any previously created content will be synced to your Altair One account. Once you login, you will be asked to provide a username that identifies you to other Community users. Email us at Community with questions.

"Macro in the filename of Read Database"

yelena_kroyelena_kro Member Posts: 6 Contributor I
edited June 2019 in Help

Hi everyone,

 

I want to use macro value (for example, macroName = query_path, macro_value = C:/Files/query1.sql) in the query file name of Read Database operator as that path is dynamic. So I put %{query_path} to the query file. And it does work giving me the following error:

---------------------------

Cannot read file

'C:\Users\myUser\query_path' - please notice it doesn't use macro value, only parsing macro name as a string

---------------------------

If filename starts from C:/ and then we add macro value (for example, query_path = Files/query1.sql), and query file parameter looks like C:/%{query_path } it works.

 

 

However, I need to specify full dynamic path to run my process with no changes on linux and windows.

Could you advise please, how to resolve?

 

PS: I also tried to use eval() and put macro name in "", it didn't help.

 

Answers

  • sgenzersgenzer Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,959 Community Manager

    hello @yelena_kro - good to have you here.  That's a weird one.  I use macros in my filenames  (normal files, not SQL) all the time but I use a Mac.  :)  Have you tried using Generate Macro and creating the whole file path as a new macro with concat?  And is there a reason you're just not creating a database connection with your SQL database and going that route?


    Scott

  • yelena_kroyelena_kro Member Posts: 6 Contributor I

    Hi Scott, thank you for your reply.

     

    I generate macro query_path and use the full path. It doesn't work, pls refer to my previous post. You can see that RapidMiner uses some weired path and doesn't translate macro in that case.

    When I take the same path with NO macro, everything works. OR when I start filename from the path (C:/), it also works. So there is no issues with file or connection.

     

    I also use the same macro path, but with different operator (for ex., ReadExcel) and it works. It doesn't work only in the Read Database operator.

     

    Sorry, I didn't get your last question. I am creating predefined DB connection, it works fine. 

  • sgenzersgenzer Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,959 Community Manager

    hello @yelena_kro - can you please paste your process XML in this thread using the </> tool?  That will make things a lot easier.

     

    Scott

     

  • yelena_kroyelena_kro Member Posts: 6 Contributor I

    Scott, I wanted to create small simple example for you to replicate the issue as my actual process is large and contains a number of sub-processes. And I noticed that I had missed '%' sign when defined query_path macro for the sub-process containing Read Database... :smileymad: My bad... Thank you for your help though!

  • sgenzersgenzer Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,959 Community Manager

    haha no problem @yelena_kro.  Glad you found the problem.  Feel free to post here again any time.

     

    Scott

Sign In or Register to comment.