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

Add all options to UnloadFromSelect, with SQLi protection #27

Merged

Conversation

graingert
Copy link
Member

No description provided.

return str(q.compile(dialect=RedshiftDialect(),
compile_kwargs={'literal_binds': True}))

return str(q.compile(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated this to match the same helper functions in test_unload_from_select

@graingert graingert force-pushed the add-all-options-to-UnloadFromSelect-with-SQLi-protection branch 3 times, most recently from 5d6e5c8 to 64f1fe4 Compare August 31, 2015 16:13
@graingert
Copy link
Member Author

@jklukas @thisfred @bouk @cpcloud: Thoughts?

^aws_access_key_id=[A-Z0-9]{20};
aws_secret_access_key=[A-Za-z0-9/+=]{40}
(?:;token=[A-Za-z0-9/+=]+)?$
""", re.VERBOSE)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Constants should be named in all caps, and I'd prefer RE or REGEX to RX unless this is conforming to a standard I'm not aware of (CREDS_RE).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@graingert graingert force-pushed the add-all-options-to-UnloadFromSelect-with-SQLi-protection branch from 64f1fe4 to 2854c96 Compare August 31, 2015 16:37
delimiter='DELIMITER AS :delimiter' if el.delimiter is not None else '',
encrypted='ENCRYPTED' if el.encrypted else '',
fixed_width=(
'FIXEDWIDTH AS :fixed_width' if el.fixed_width is not None else ''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why check None specifically here rather than relying on the boolean interpretation of el.fixed_width? Would we want to omit this clause in the case of an empty list?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None is the default? I think I want it to break accordingly if someone passes an empty list or False. I'm not tied to this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay I'm updating fixed_width, note null and delimiter must be is not None or we can't support the empty string null or delimiter value

@graingert graingert force-pushed the add-all-options-to-UnloadFromSelect-with-SQLi-protection branch from 2854c96 to 3a684a3 Compare August 31, 2015 16:44
@jklukas
Copy link
Member

jklukas commented Aug 31, 2015

This is looking much nicer for the refactor. I like this PR.

@graingert graingert force-pushed the add-all-options-to-UnloadFromSelect-with-SQLi-protection branch 5 times, most recently from 4afa5ae to d6693a6 Compare August 31, 2015 23:25
validate credentials before format

Better exception text

prevent an empty FIXEDWITH string as that's an error.
@graingert graingert force-pushed the add-all-options-to-UnloadFromSelect-with-SQLi-protection branch from d6693a6 to cdcd103 Compare August 31, 2015 23:30
graingert added a commit that referenced this pull request Aug 31, 2015
…lect-with-SQLi-protection

Add all options to UnloadFromSelect, with SQLi protection
@graingert graingert merged commit b48dbe7 into master Aug 31, 2015
@graingert graingert deleted the add-all-options-to-UnloadFromSelect-with-SQLi-protection branch August 31, 2015 23:36
haleemur pushed a commit to haleemur/redshift_sqlalchemy that referenced this pull request Sep 2, 2015
…ons-to-UnloadFromSelect-with-SQLi-protection

Add all options to UnloadFromSelect, with SQLi protection
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

Successfully merging this pull request may close these issues.

4 participants