@@ -2594,7 +2594,7 @@ def extract(
25942594 multiple = True ,
25952595 help = "Column definitions for the table" ,
25962596)
2597- @click .option ("--pk" , type = str , help = "Column to use as primary key" )
2597+ @click .option ("pks" , " --pk" , help = "Column to use as primary key" , multiple = True )
25982598@click .option ("--alter" , is_flag = True , help = "Alter table to add missing columns" )
25992599@click .option ("--replace" , is_flag = True , help = "Replace files with matching primary key" )
26002600@click .option ("--upsert" , is_flag = True , help = "Upsert files with matching primary key" )
@@ -2611,7 +2611,7 @@ def insert_files(
26112611 table ,
26122612 file_or_dir ,
26132613 column ,
2614- pk ,
2614+ pks ,
26152615 alter ,
26162616 replace ,
26172617 upsert ,
@@ -2641,8 +2641,8 @@ def insert_files(
26412641 column = ["path:path" , "content_text:content_text" , "size:size" ]
26422642 else :
26432643 column = ["path:path" , "content:content" , "size:size" ]
2644- if not pk :
2645- pk = "path"
2644+ if not pks :
2645+ pks = [ "path" ]
26462646
26472647 def yield_paths_and_relative_paths ():
26482648 for f_or_d in file_or_dir :
@@ -2712,7 +2712,11 @@ def _content_text(p):
27122712 try :
27132713 with db .conn :
27142714 db [table ].insert_all (
2715- to_insert (), pk = pk , alter = alter , replace = replace , upsert = upsert
2715+ to_insert (),
2716+ pk = pks [0 ] if len (pks ) == 1 else pks ,
2717+ alter = alter ,
2718+ replace = replace ,
2719+ upsert = upsert ,
27162720 )
27172721 except UnicodeDecodeErrorForPath as e :
27182722 raise click .ClickException (
0 commit comments