-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
Export schemas #4260
base: develop
Are you sure you want to change the base?
Export schemas #4260
Conversation
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.
Overall, pretty good. I have some changes to request for the actual pg_dump
command.
'-U', conn.info.user, | ||
'-d', conn.info.dbname, | ||
'-n', sql.Identifier(schema_name).as_string(), | ||
'-O' # Don't include owner info in the dump |
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 you should add the --inserts
flag here. We should prioritize compatibility over performance, unless the performance really becomes a problem for someone.
I'd also like you to look into whether there's a flag to add that will get rid of the SET
commands at the start of the file. Those can also cause problems when loading, and aren't usually needed.
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'd also like you to look into whether there's a flag to add that will get rid of the SET commands at the start of the file.
There is no such flag, unfortunately, users would have to take those statements out manually. Apparently, postgres includes those statements to make sure that upon restore, the server behaves exactly the same as when the dump was created.
Given this, and the fact that we use GENERATED BY DEFAULT AS IDENTITY
for id
columns, would it make sense for us to prioritize compatibility over performance? The performance for someone dumping their local database and restoring it on a remote server would be terrible if there's a lot of data. Assuming this being a fairly common use case for someone using our product.
@mathemancer As discussed in our 1:1, the dumps will now include the |
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.
LGTM.
For context, for anyone watching, we're going to assume that we'll have postgres-client
installed on the service layer for the foreseeable future.
@pavish we'll wait to merge this till you review the front end changes. |
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.
- The export fails whenever the schema has at least one table that the user does not have select privileges on. For this scenario, I'd either expect the "Export" button to not be enabled, show a valid error, or export only the tables that the user has access to.
- I do think there might be additional cases where export would fail due to permission related issues and we have to test it all.
- I'd like the Export button to be placed within a dropdown menu. For eg., Similar to the dropdown in the Database Page which contains the Disconnect Database option.
- The chances that the user would export the entire schema as a SQL file is low that it does not warrant us placing the Export button in such a prominent location.
@pavish I agree with your critique,
As far as export behavior is concerned, out of these three, I'd prefer the first option. I don't think this feature would be of much use to the user if we only dump a subset of tables from their schema. They could do that anyway with per table CSV export.
I agree. That said, it would take me a while to figure out these changes on the frontend, and given that we want to cut our release tomorrow, would you be able to take over the frontend changes required? So that we can get this in before the feature freeze? |
@Anish9901 I do think @pavish's feedback should block this PR from inclusion in the current release if it can't be resolved by end of tomorrow. If it can, great! I also think the triple-dot menu that triggers a dropdown, like that on the DB page, is also a good choice for the design. Lastly, when I think about use cases for functionality like this, I can imagine there are users who would only want to export the structure of a schema and not just the data, depending on the scenario. It would be nice to offer both options in the future. There's an incongruity in the current approach where we offer csv data export at the table-level but sql data export at the schema level and both of these are labeled with the same "Export" button. I could see that being confusing. But I think it can be optimized in the future. |
@Anish9901 The UI changes are not my primary concern. I'm not entirely sure about our product strategy with exporting schemas. We've jumped right into implementation on this rather than having a product level discussion on the requirements. The fact that export would fail even if one table is owned by another user is not a good idea. I'd rather have the functionality working for all users, and export only the data that the user has access to. Until we have that figured out, the other reasonable option is to limit this functionality to database superusers only. I'd rather wait a couple days to resolve this (and get it into the next release) rather than rushing the PR just to get it into this release. cc: @zackkrida |
35b4812
to
efbae44
Compare
@Anish9901 @zackkrida @mathemancer
With these changes, I think this PR could go into 0.2.1. I'll leave it to @zackkrida and @Anish9901 to make the call. However, I also think we should discuss this feature holistically and it's actual usecase/user requirements soon after, I'm not entirely convinced about it's usefulness with the current implementation. |
@Anish9901 @pavish @mathemancer: I also think the PR could be merged in it's current state. I really appreciate the improvements you've made, @pavish. However, I think it is best to draft this PR and save it for the next release for the following reasons: It isn't clear to me yet who this functionality is for and what goal its intended to serve. When we do include it in a release I'd like to be able to give a clear impression of the value it offers to our users. Furthermore, if some discussion from the team and a refinement of this PR could make it significantly more useful to users, I'd like to take the extra time to do so before we include it in a release. I'll draft this now just so it's clear that it shouldn't be merged in the short term. |
@pavish @zackkrida Here are some of my thoughts: The problem with exporting a subset of tables as SQL:
Who is this feature useful for?
How can we extend this in the future?
|
Fixes #4250
Lets you export your schemas along with its table contents.
Checklist
Update index.md
).develop
branch of the repositoryvisible errors.
Developer Certificate of Origin
Developer Certificate of Origin