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

[Importer] Add keep-existing-columns flag #1076

Draft
wants to merge 126 commits into
base: main
Choose a base branch
from

Conversation

SferaDev
Copy link
Member

@SferaDev SferaDev commented Jul 12, 2023

Add new flag keep-existing-columns to merge an existing table columns with the parsed types

  • In the case that the guessed type is different, we don't prompt for a migration, the import will attempt to coerce the value instead and will fail if not able to coerce it

SferaDev and others added 30 commits December 23, 2022 10:20
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
Signed-off-by: Alexis Rico <[email protected]>
@changeset-bot
Copy link

changeset-bot bot commented Jul 12, 2023

⚠️ No Changeset found

Latest commit: d0c81b8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Jul 12, 2023

size-limit report 📦

Path Size
packages/client/dist/index.mjs 16.08 KB (0%)
packages/client/dist/index.cjs 17.27 KB (0%)
packages/codegen/dist/index.mjs 2.55 MB (0%)
packages/codegen/dist/index.cjs 2.56 MB (0%)

@github-actions
Copy link
Contributor

github-actions bot commented Jul 12, 2023

Your pull request has been published to npm.

You can install @xata.io/client by running:

npm install @xata.io/[email protected]

Other packages are published like this:

npm install @xata.io/[email protected]

To test the CLI, run:

npx @xata.io/[email protected]

Signed-off-by: Alexis Rico <[email protected]>
@SferaDev SferaDev changed the title Importer CLI improvements Allow importing link columns from the CLI Jul 12, 2023
@SferaDev SferaDev marked this pull request as ready for review July 12, 2023 06:45
@SferaDev SferaDev requested a review from a team as a code owner July 12, 2023 06:45
@kostasb
Copy link
Contributor

kostasb commented Jul 12, 2023

Tried it out, some feedback:

with the existing table schema having brokerage as link, the CLI suggests to remove the link column (brokerage)

id,licenseNumber,licenseHolderName,licenseType,stateLicenseType,brokerage,licenseExpirationDate,address1,address2,city,county,zip,state
1,license1,name1,type1,state1,broker1,2023-07-10T16:04:33.932152Z,addr1,addr2,ny,us,16232,california
xataCli import csv agentities.csv --table=agent
✖ WARNING: The following columns will be removed and you will lose data. brokerage. 
Do you want to continue? …

(This doesn't happen with --keep-existing-columns)

@SferaDev
Copy link
Member Author

SferaDev commented Jul 12, 2023

Yeah, without the flag it will try to remove the link column and create an int one, this is the new default behaviour that @richardgill implemented with the new importer. There could be a discussion about if that should be the default or not, no strong preferences in this case (because we have a flag for both cases), up to @richardgill

@kostasb
Copy link
Contributor

kostasb commented Jul 12, 2023

We can provide a hint to use the flag keep-existing-columns in this warning message then?

@SferaDev SferaDev marked this pull request as draft July 12, 2023 11:35
@SferaDev SferaDev changed the title Allow importing link columns from the CLI [Importer] Add keep-existing-columns flag Jul 12, 2023
Base automatically changed from new-importer-richard to main July 12, 2023 11:49
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.

4 participants