Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
use .sql instead of script
#1
Hi, I have one question , is possible to replace one thing on the script . I have the script. It works good, but i would like use text.sql intead of select tab.num from tabulka tab. Is it possible if yes how. I do not find any script, how can i solve this thanks. I use plsql developer
#run script
# Import sqlalchemy's create_engine() function

# Create the database engine
engine = create_engine('oracle+cx_oracle://dw1:dw2@local/DW3')

df = pd.read_sql("""
select
tab.num
from tabulka tab
""",engine)
df.head()

#import data to table

engine = create_engine('oracle+cx_oracle://dw1:dw2@local/DW3')

df.to_sql('tt',con=engine,if_exists='append',index=False)
deanhystad write Jan-08-2024, 12:14 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020