-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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: Surface parameters fields for database model #14646
Conversation
host: string; | ||
password?: string; | ||
port: number; | ||
query: Object; |
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.
I think it is better to use the query props here, which I think you can import.
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.
Confusingly, this is a different query: https://docs.sqlalchemy.org/en/14/core/engines.html#add-parameters-to-the-url-query-string
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.
oh interesting, so then would Record<string, string> be more explicit here given that it has string keys and values?
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.
That sounds like a good plan.
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.
I also added in some props in #14583. For bigquery most of those props are going be optional (maybe some other dbs too). Are we going to use db parameters for Gsheets for example?
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.
@AAfghahi right, Record<string, string>
But we need to keep in mind that these are specific for Postgres and similar databases. For other DBs some attributes might be optional, or there might be a different set of attributes, so maybe we should just define the type as Object
.
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.
that's fair, I hadn't considered that.
Codecov Report
@@ Coverage Diff @@
## master #14646 +/- ##
==========================================
+ Coverage 77.20% 77.59% +0.39%
==========================================
Files 958 958
Lines 48492 49127 +635
Branches 5691 5767 +76
==========================================
+ Hits 37437 38119 +682
+ Misses 10855 10787 -68
- Partials 200 221 +21
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@property | ||
def parameters(self) -> Optional[Dict[str, Any]]: | ||
# Build parameters if db_engine_spec is a subclass of BasicParametersMixin | ||
parameters = {"engine": self.backend} |
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.
so for sqlalchemy forms, we're only going to return engine? Maybe that should be the only required type then, it looks like.
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.
Yea good catch i'll make sure to update the type on the types file
# Build parameters if db_engine_spec is a subclass of BasicParametersMixin | ||
parameters = {"engine": self.backend} | ||
|
||
if issubclass(self.db_engine_spec, BasicParametersMixin): |
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.
After we add BQ we need to change this, right?
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.
Yea that PR will have the updated logic here to allow us to pass Big Query credentials
closing in favor of #14653 |
SUMMARY
Update the api to surface parameters in GET
database
. This will be leveraged for whenever a user wants to edit a database assuming configuration type is dynamic.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TEST PLAN
ADDITIONAL INFORMATION