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

feat(Database): Add support for parsing booleans #508

Merged
merged 7 commits into from
Dec 16, 2021

Conversation

dannyboy15
Copy link
Contributor

Add the ability to parse (sql) booleans. By default the option is turned off, to ensure current workflows don't unintentionally get altered.

To turn on boolean parsing set

DatabaseCreateStatement.DO_PARSE_BOOLS = True

test/test_databases/test_database.py Show resolved Hide resolved
str(val).upper() in self.TRUE_VALS + self.FALSE_VALS):
return True
return False

def detect_data_type(self, value, cmp_type=None):
Copy link
Contributor

@ChrisC ChrisC Jun 29, 2021

Choose a reason for hiding this comment

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

It might be easier to toggle the Boolean parsing on or off (especially in the test suites) if we pass it as an optional argument in this function, instead of the config setting on the base class. Something like:
def detect_data_type(self, value, cmp_type=None, do_parse_bools=False):

@ChrisC
Copy link
Contributor

ChrisC commented Dec 16, 2021

@dannyboy15 I added the requested changes about separate test cases for the DB boolean parsing... I think you might have had some other ideas about how to approach but merging this in now to keep it current. Feel free to submit another PR if you want to modify the approach!

@ChrisC ChrisC merged commit 766cfae into move-coop:master Dec 16, 2021
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.

2 participants