Python Forum
New to Python - is this possible??
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New to Python - is this possible??
#1
I have been assigned a project to change several table and column names; we are moving to Oracle 19 and it allows for table and/or column names to be longer than 30 characters (the old Oracle limit). I can produce a spread sheet that maps the “old” table/columns" to their new names. I was thinking of doing this thru a macro in Notepad++ but didn’t find a way to read an external file. BTW, I would export the spreadsheet into a comma-delimited file and then I would try to a macro to do the replacements.
Is this possible or am I just dreaming??

I received this reply: No, macros can only do internal notepad++ / editor commands (either accessing the text of the active file, or doing notepad++ menu actions)

If you are willing to do something fancier, there are scripting plugins (like PythonScript and LuaScript) which allow you to write arbitrary scripts in your favorite interpreted language with extra commands that have access to the text in open files and the notepad++ gui/menus.

So, give the above information, has anyone had a similar task?
Also, is Python capable of doing this or should I look for another alternative??
Reply
#2
Things like this are done in python all the time.
A good place to search for the packages you will need is: https://pypi.org/
for example packages to read and write oracle databases: https://pypi.org/search/?q=oracle
csv reader is built into python and simple to use, example:
import csv

def read_csv(filename):
    with open(filename) as fp:
        crdr = csv.reader(fp):
        for row in crdr:
            print(row)

read_csv("mycsvfilename")
Reply


Forum Jump:

User Panel Messages

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