18F / rdbms-subsetter

Generates a subset of a relational database that respects foreign key constraints
Creative Commons Zero v1.0 Universal
313 stars 30 forks source link

Use `raw_input` in `confirm()` method #9

Closed mrchrisadams closed 9 years ago

mrchrisadams commented 9 years ago

Previously when I would run rdbms-subsetter, I'd get output along the lines of:

Create XXXX rows from source_database in schema.table
Create XXXX rows from source_database in schema.table
Create XXXX rows from source_database in schema.table
Create XXXX rows from source_database in schema.table
Proceed? (Y/n)

Pressing Y, or y would trigger an error, with the script complaint that Y wasn't defined. I had to end up using "Y" to proceed.

This tripped me up when using it on a project of my own, and it's a simple enough fix to add, so I'm proposing the use of raw_input instead of input, because it removes the need for you wrap Y in a string when confirming the creation of rows in tables.

catherinedevlin commented 9 years ago

Hi, Chris - thanks for alerting me to this.

Sorry it took me so long to evaluate it - I have to admit, I forgot I was even supporting Python2, and your error completely confused me. I had to go educate myself in the input/raw_input Python 2/3 situation.

This particular PR would break Python3 (where raw_input has been removed), so I'm closing it, but you did prompt me to write a fix that should let Python2 work again. It's in the trunk now and will be released with 0.2.3.

mrchrisadams commented 9 years ago

That works for me, thanks! :+1: