@@ -1087,6 +1087,7 @@ def create_csv_table(
10871087 mode : str = "overwrite" ,
10881088 catalog_versioning : bool = False ,
10891089 sep : str = "," ,
1090+ skip_header_line_count : Optional [int ] = None ,
10901091 boto3_session : Optional [boto3 .Session ] = None ,
10911092 projection_enabled : bool = False ,
10921093 projection_types : Optional [Dict [str , str ]] = None ,
@@ -1125,6 +1126,8 @@ def create_csv_table(
11251126 If True and `mode="overwrite"`, creates an archived version of the table catalog before updating it.
11261127 sep : str
11271128 String of length 1. Field delimiter for the output file.
1129+ skip_header_line_count : Optional[int]
1130+ Number of Lines to skip regarding to the header.
11281131 projection_enabled : bool
11291132 Enable Partition Projection on Athena (https://docs.aws.amazon.com/athena/latest/ug/partition-projection.html)
11301133 projection_types : Optional[Dict[str, str]]
@@ -1181,6 +1184,7 @@ def create_csv_table(
11811184 partitions_types = partitions_types ,
11821185 compression = compression ,
11831186 sep = sep ,
1187+ skip_header_line_count = skip_header_line_count ,
11841188 )
11851189 session : boto3 .Session = _utils .ensure_session (session = boto3_session )
11861190 _create_table (
@@ -1338,20 +1342,24 @@ def _csv_table_definition(
13381342 partitions_types : Dict [str , str ],
13391343 compression : Optional [str ],
13401344 sep : str ,
1345+ skip_header_line_count : Optional [int ]
13411346) -> Dict [str , Any ]:
13421347 compressed : bool = compression is not None
1348+ parameters : Dict [str , str ] = {
1349+ "classification" : "csv" ,
1350+ "compressionType" : str (compression ).lower (),
1351+ "typeOfData" : "file" ,
1352+ "delimiter" : sep ,
1353+ "columnsOrdered" : "true" ,
1354+ "areColumnsQuoted" : "false" ,
1355+ }
1356+ if skip_header_line_count is not None :
1357+ parameters ["skip.header.line.count" ] = "1"
13431358 return {
13441359 "Name" : table ,
13451360 "PartitionKeys" : [{"Name" : cname , "Type" : dtype } for cname , dtype in partitions_types .items ()],
13461361 "TableType" : "EXTERNAL_TABLE" ,
1347- "Parameters" : {
1348- "classification" : "csv" ,
1349- "compressionType" : str (compression ).lower (),
1350- "typeOfData" : "file" ,
1351- "delimiter" : sep ,
1352- "columnsOrdered" : "true" ,
1353- "areColumnsQuoted" : "false" ,
1354- },
1362+ "Parameters" : parameters ,
13551363 "StorageDescriptor" : {
13561364 "Columns" : [{"Name" : cname , "Type" : dtype } for cname , dtype in columns_types .items ()],
13571365 "Location" : path ,
0 commit comments