Skip to content

fix(sqlite-migrate): Use int when getting pk column information#6848

Merged
kodiakhq[bot] merged 2 commits intocloudquery:mainfrom
erezrokah:fix/sqlite_migrate
Jan 17, 2023
Merged

fix(sqlite-migrate): Use int when getting pk column information#6848
kodiakhq[bot] merged 2 commits intocloudquery:mainfrom
erezrokah:fix/sqlite_migrate

Conversation

@erezrokah
Copy link
Copy Markdown
Member

@erezrokah erezrokah commented Jan 16, 2023

Summary

SQLite migration always fails on tables that have multiple PKs. The reason is that pk in table_info is either 0 for non PKs or the 1 based index of the column within the PKs (usually 1 for a single PK, but can be 2, 3, etc.)
See https://www.sqlite.org/pragma.html#pragma_table_info.

If you remove the fix you'll get the following error:

failed to get table table_1 columns types: sql: Scan error on column index 5, name "pk": sql/driver: couldn't convert 2 into type bool

@erezrokah erezrokah requested review from a team and shimonp21 and removed request for a team January 16, 2023 15:02
@cq-bot cq-bot added the sqlite label Jan 16, 2023
@erezrokah erezrokah added the automerge Automatically merge once required checks pass label Jan 16, 2023
Copy link
Copy Markdown
Contributor

@shimonp21 shimonp21 left a comment

Choose a reason for hiding this comment

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

Tested manually - Approving :)

@kodiakhq kodiakhq bot merged commit 8ed1d94 into cloudquery:main Jan 17, 2023
kodiakhq bot pushed a commit that referenced this pull request Jan 17, 2023
🤖 I have created a release *beep* *boop*
---


## [1.1.6](plugins-destination-sqlite-v1.1.5...plugins-destination-sqlite-v1.1.6) (2023-01-17)


### Bug Fixes

* **deps:** Update module github.com/cloudquery/plugin-sdk to v1.24.2 ([#6695](#6695)) ([694ab9f](694ab9f))
* **deps:** Update module github.com/cloudquery/plugin-sdk to v1.25.0 ([#6745](#6745)) ([9c41854](9c41854))
* **deps:** Update module github.com/cloudquery/plugin-sdk to v1.25.1 ([#6805](#6805)) ([9da0ce2](9da0ce2))
* **deps:** Update module github.com/cloudquery/plugin-sdk to v1.26.0 ([#6839](#6839)) ([6ccda8d](6ccda8d))
* **deps:** Update module github.com/cloudquery/plugin-sdk to v1.27.0 ([#6856](#6856)) ([545799b](545799b))
* **sqlite-migrate:** Use `int` when getting `pk` column information ([#6848](#6848)) ([8ed1d94](8ed1d94))
* **sqlite:** Set module in logs to `sqlite-dest` instead of `pg-dest` ([#6764](#6764)) ([6cfda91](6cfda91))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge Automatically merge once required checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants