Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6613291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:12:04+00:00 2026-05-25T20:12:04+00:00

Is there a way to execute a sql script file using cx_oracle in python.

  • 0

Is there a way to execute a sql script file using cx_oracle in python.

I need to execute my create table scripts in sql files.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:12:04+00:00Added an answer on May 25, 2026 at 8:12 pm

    PEP-249, which cx_oracle tries to be compliant with, doesn’t really have a method like that.

    However, the process should be pretty straight forward. Pull the contents of the file into a string, split it on the “;” character, and then call .execute on each member of the resulting array. I’m assuming that the “;” character is only used to delimit the oracle SQL statements within the file.

    f = open('tabledefinition.sql')
    full_sql = f.read()
    sql_commands = full_sql.split(';')
    
    for sql_command in sql_commands:
        curs.execute(sql_command)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to execute .sql scripts that are on my hard drive
Is there a way to execute SQL custom functions with Enterpise Library? I've tried
Is there a way to get the raw SQL string executed when calling PDOStatement::execute()
Is there a way to execute a full ASPX source file where the page
Is there a way to execute a query(containing built in DB function) using PreparedStatement?
Is there a way to execute script when an UpdatePanel process is finished. I
I have a sql script file that upon import creates a table in a
I need to run a sql script that is in a file from my
I have 10 transact SQL scripts that each create a table and fill it
I have many table creation scripts (sql files), which I would like to run,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.