56
56
GCS_SERVICE_HOST ,
57
57
GCS_TOKEN ,
58
58
GCS_TOKEN_EXPIRES_AT_MS ,
59
+ ADLS_ACCOUNT_NAME ,
60
+ ADLS_ACCOUNT_KEY ,
61
+ ADLS_BLOB_STORAGE_AUTHORITY ,
62
+ ADLS_DFS_STORAGE_SCHEME ,
63
+ ADLS_BLOB_STORAGE_SCHEME ,
64
+ ADLS_DFS_STORAGE_AUTHORITY ,
59
65
fsspec ,
60
66
load_file_io ,
61
67
)
@@ -348,6 +354,11 @@ def table_schema_with_all_types() -> Schema:
348
354
)
349
355
350
356
357
+ @pytest .fixture (params = ["abfss" , "wasbs" ])
358
+ def adls_scheme (request ):
359
+ return request .param
360
+
361
+
351
362
@pytest .fixture (scope = "session" )
352
363
def pyarrow_schema_simple_without_ids () -> "pa.Schema" :
353
364
import pyarrow as pa
@@ -2089,7 +2100,27 @@ def fsspec_fileio_gcs(request: pytest.FixtureRequest) -> FsspecFileIO:
2089
2100
2090
2101
2091
2102
@pytest .fixture
2092
- def pyarrow_fileio_gcs (request : pytest .FixtureRequest ) -> "PyArrowFileIO" :
2103
+ def adls_fsspec_fileio (request : pytest .FixtureRequest ) -> Generator [FsspecFileIO , None , None ]:
2104
+ from azure .storage .blob import BlobServiceClient
2105
+
2106
+ azurite_url = request .config .getoption ("--adls.endpoint" )
2107
+ azurite_account_name = request .config .getoption ("--adls.account-name" )
2108
+ azurite_account_key = request .config .getoption ("--adls.account-key" )
2109
+ azurite_connection_string = f"DefaultEndpointsProtocol=http;AccountName={ azurite_account_name } ;AccountKey={ azurite_account_key } ;BlobEndpoint={ azurite_url } /{ azurite_account_name } ;"
2110
+ properties = {
2111
+ "adls.connection-string" : azurite_connection_string ,
2112
+ "adls.account-name" : azurite_account_name ,
2113
+ }
2114
+
2115
+ bbs = BlobServiceClient .from_connection_string (conn_str = azurite_connection_string )
2116
+ bbs .create_container ("tests" )
2117
+ yield fsspec .FsspecFileIO (properties = properties )
2118
+ bbs .delete_container ("tests" )
2119
+ bbs .close ()
2120
+
2121
+
2122
+ @pytest .fixture
2123
+ def pyarrow_fileio_gcs (request : pytest .FixtureRequest ) -> 'PyArrowFileIO' :
2093
2124
from pyiceberg .io .pyarrow import PyArrowFileIO
2094
2125
2095
2126
properties = {
@@ -2101,6 +2132,33 @@ def pyarrow_fileio_gcs(request: pytest.FixtureRequest) -> "PyArrowFileIO":
2101
2132
return PyArrowFileIO (properties = properties )
2102
2133
2103
2134
2135
+ @pytest .fixture
2136
+ def pyarrow_fileio_adls (request : pytest .FixtureRequest ) -> Generator [Any , None , None ]:
2137
+ from azure .storage .blob import BlobServiceClient
2138
+ from pyiceberg .io .pyarrow import PyArrowFileIO
2139
+
2140
+ azurite_url = request .config .getoption ("--adls.endpoint" )
2141
+ azurite_scheme , azurite_authority = azurite_url .split ('://' , 1 )
2142
+
2143
+ azurite_account_name = request .config .getoption ("--adls.account-name" )
2144
+ azurite_account_key = request .config .getoption ("--adls.account-key" )
2145
+ azurite_connection_string = f"DefaultEndpointsProtocol=http;AccountName={ azurite_account_name } ;AccountKey={ azurite_account_key } ;BlobEndpoint={ azurite_url } /{ azurite_account_name } ;"
2146
+ properties = {
2147
+ ADLS_ACCOUNT_NAME : azurite_account_name ,
2148
+ ADLS_ACCOUNT_KEY : azurite_account_key ,
2149
+ ADLS_BLOB_STORAGE_AUTHORITY : azurite_authority ,
2150
+ ADLS_DFS_STORAGE_AUTHORITY : azurite_authority ,
2151
+ ADLS_BLOB_STORAGE_SCHEME : azurite_scheme ,
2152
+ ADLS_DFS_STORAGE_SCHEME : azurite_scheme ,
2153
+ }
2154
+
2155
+ bbs = BlobServiceClient .from_connection_string (conn_str = azurite_connection_string )
2156
+ bbs .create_container ("warehouse" )
2157
+ yield PyArrowFileIO (properties = properties )
2158
+ bbs .delete_container ("warehouse" )
2159
+ bbs .close ()
2160
+
2161
+
2104
2162
def aws_credentials () -> None :
2105
2163
os .environ ["AWS_ACCESS_KEY_ID" ] = "testing"
2106
2164
os .environ ["AWS_SECRET_ACCESS_KEY" ] = "testing"
@@ -2162,26 +2220,6 @@ def fixture_dynamodb(_aws_credentials: None) -> Generator[boto3.client, None, No
2162
2220
yield boto3 .client ("dynamodb" , region_name = "us-east-1" )
2163
2221
2164
2222
2165
- @pytest .fixture
2166
- def adls_fsspec_fileio (request : pytest .FixtureRequest ) -> Generator [FsspecFileIO , None , None ]:
2167
- from azure .storage .blob import BlobServiceClient
2168
-
2169
- azurite_url = request .config .getoption ("--adls.endpoint" )
2170
- azurite_account_name = request .config .getoption ("--adls.account-name" )
2171
- azurite_account_key = request .config .getoption ("--adls.account-key" )
2172
- azurite_connection_string = f"DefaultEndpointsProtocol=http;AccountName={ azurite_account_name } ;AccountKey={ azurite_account_key } ;BlobEndpoint={ azurite_url } /{ azurite_account_name } ;"
2173
- properties = {
2174
- "adls.connection-string" : azurite_connection_string ,
2175
- "adls.account-name" : azurite_account_name ,
2176
- }
2177
-
2178
- bbs = BlobServiceClient .from_connection_string (conn_str = azurite_connection_string )
2179
- bbs .create_container ("tests" )
2180
- yield fsspec .FsspecFileIO (properties = properties )
2181
- bbs .delete_container ("tests" )
2182
- bbs .close ()
2183
-
2184
-
2185
2223
@pytest .fixture (scope = "session" )
2186
2224
def empty_home_dir_path (tmp_path_factory : pytest .TempPathFactory ) -> str :
2187
2225
home_path = str (tmp_path_factory .mktemp ("home" ))
0 commit comments