Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support utf-8 files oracle_sql module #6

Open
kalemontes opened this issue Nov 18, 2022 · 0 comments
Open

Support utf-8 files oracle_sql module #6

kalemontes opened this issue Nov 18, 2022 · 0 comments

Comments

@kalemontes
Copy link

Hello,
First things first, thanks for this collection, it's helping me a lots :)

I bumped into an encoding issue when using the oracle_sql module.

[UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 23: ordinal not in range(128)](https://stackoverflow.com/questions/24475393/unicodedecodeerror-ascii-codec-cant-decode-byte-0xc3-in-position-23-ordinal)

First i though it was the file am using to insert data, but it is well encode (UTF-8) as i have non ansi on people's names. So i dug a bit and was able to patch this issue by adding the encoding open().

else:  # SQL file
        try:
            file_name = script.lstrip('@')
            with open(file_name, 'r', encoding="utf-8") as f:
                execute_statements(f.read())
            module.exit_json(msg='DML or DDL statements executed.', changed=True, statements=ora_db.ddls,
                             output_lines=output_lines)
        except IOError as e:
            module.fail_json(msg=str(e), changed=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant