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

Introduce new merge CLI #19

Merged
merged 1 commit into from
Apr 7, 2024
Merged

Introduce new merge CLI #19

merged 1 commit into from
Apr 7, 2024

Conversation

fzakaria
Copy link
Owner

@fzakaria fzakaria commented Feb 4, 2024

❯ sqlelf-merge ruby.sqlite bash.sqlite

❯ sqlite3 output.sqlite
-- Loading resources from /usr/local/google/home/fmzakari/.sqliterc
SQLite version 3.44.0 2023-11-01 11:23:50
Enter ".help" for usage hints.
sqlite> select * from elf_headers;
path           type     machine  version  entry   is_pie
-------------  -------  -------  -------  ------  ------
/usr/bin/ruby  DYNAMIC  x86_64   CURRENT  4400    1     
/bin/bash      DYNAMIC  x86_64   CURRENT  202576  1     
Program interrupted.m elf_headers;^C

The assumption are that the schemas are identical otherwise you get errors if there is a missing column such as:

❯ sqlelf-merge ruby.sqlite bash.sqlite
ERROR:root:SQLITE_LOG: SELECTs to the left and right of UNION ALL do not have the same number of result columns in "
            CREATE TABLE elf_headers AS
            SELECT * FROM DB0.elf_headers UNION ALL SELECT * FROM DB1.elf_h (1) SQLITE_ERROR
Traceback (most recent call last):
  File "/usr/local/google/home/fmzakari/code/github.com/fzakaria/sqlelf/.direnv/python-3.11/bin/sqlelf-merge", line 8, in <module>
    sys.exit(start())
             ^^^^^^^
  File "/usr/local/google/home/fmzakari/code/github.com/fzakaria/sqlelf/sqlelf/tools/merge.py", line 84, in start
    conn.execute(sql)
  File "src/cursor.c", line 959, in APSWCursor_execute.sqlite3_prepare_v3
apsw.SQLError: SQLError: SELECTs to the left and right of UNION ALL do not have the same number of result columns

@fzakaria
Copy link
Owner Author

fzakaria commented Feb 4, 2024

@markrwilliams what do you think?

@fzakaria fzakaria merged commit 353635c into main Apr 7, 2024
2 checks passed
@fzakaria fzakaria deleted the merge branch April 7, 2024 00:17
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.

1 participant