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
Enable check constraint reflection #46
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using contextlib because pyhdb does not implement exit and enter method
Also those unique constraints should be returned which do not have a user defined name, but primary keys should not be returned as unique constraints
The test needs to be overwritten, because in case of HANA, if a user tries to reflect the referential action for foreign keys, they are always reflected even if the user does not explicitly change the options to be used, i.e. the default referential action being used by the database is reflected. In no case in SQLAlchemy-hana an empty dictionary is returned for foreign key options.
… differences between different databases, hence check constraints reflection tests work fine
jarus
requested changes
May 23, 2018
sqlalchemy_hana/dialect.py
Outdated
@@ -56,8 +56,8 @@ def limit_clause(self, select, **kwargs): | |||
text += "\n LIMIT " + self.process(select._limit_clause, **kwargs) | |||
if select._offset_clause is not None: | |||
if select._limit_clause is None: | |||
# Dirty Hack but HANA only support OFFSET with LIMIT <integer> | |||
text += "\n LIMIT 999999" | |||
# 2147384648 is the max. no. of records per (non-partitioned) table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
per result set
docs/index.rst
Outdated
@@ -109,7 +109,7 @@ SAP HANA also comes with an option to have an IDENTITY column which can also be | |||
LIMIT/OFFSET Support | |||
-------------------- | |||
|
|||
SAP HANA supports both LIMIT and OFFSET, but it only supports OFFSET in conjunction with LIMIT i.e. in the select statement the offset parameter cannot be set without the LIMIT clause, hence in sqlalchemy-hana if the user tries to use offset without limit, a limit of 999999 would be set, this has been done so that the users can smoothly use LIMIT/OFFSET as in other databases that do not have this limitation. | |||
SAP HANA supports both LIMIT and OFFSET, but it only supports OFFSET in conjunction with LIMIT i.e. in the select statement the offset parameter cannot be set without the LIMIT clause, hence in sqlalchemy-hana if the user tries to use offset without limit, a limit of 2147384648 would be set, this has been done so that the users can smoothly use LIMIT/OFFSET as in other databases that do not have this limitation. 2147384648 was chosen, because it is the maximum number of records that a non-partitioned table can have. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I know it is actual the limit of a result set which is more the reason for the choice.
Updated |
jarus
approved these changes
May 23, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check constraint tests work perfectly now, due to changes in SQLAlchemy tests to minimize syntax differences in databases