Python Script output in a variable?

More
1 year 11 months ago #24017 by prashant
When running a python script using a package, can the output of a python script inside a variable?

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago - 1 year 11 months ago #24018 by prashant
let's say a simple script
Code:
from datetime import date print(f"Today is {date.today()}") 

It's output -
Code:
Today is 2024-07-13
This to be stored in variable to be used for other part of package
Last edit: 1 year 11 months ago by prashant.

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago - 1 year 11 months ago #24019 by Peter.Jonson
You can use etltools package

This wiki article has an example

www.etl-tools.com/wiki/knowledgebase/tips/working-with-python/

Peter Jonson
ETL Developer
Last edit: 1 year 11 months ago by Peter.Jonson.

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #24025 by prashant
I will try to get chatgpt to adapt to this change & revert back
The following user(s) said Thank You: Peter.Jonson

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #24035 by prashant
Question , how we pass variables when running a package script?

Assuming I have a variable <f001> with value "Hello,world" . Ofcourse I get an error saying f001 not defined. I am sure I am missing set variable somewhere

import etltools
 def main():    
etltools.SetVariable('abba.value',<f001> )
main()
Result.Value = 1
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #24036 by admin
I think <f001> must be in quotes

Mike
ETL Architect

Please Log in or Create an account to join the conversation.

Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Read more
Marketing
Set of techniques which have for object the commercial strategy and in particular the market study.
Google
Accept
Decline
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Google Analytics
Accept
Decline
Functional
Tools used to give you more features when navigating on the website, this can include social sharing.
Advertisement
If you accept, the ads on the page will be adapted to your preferences.
Google Ad
Accept
Decline
Save