Error : External table 'habitant_gold' is not accessible because location does not exist or it is used by another process.

Mehdi SAADI 0 Reputation points
2025-04-13T18:12:00.97+00:00

When I run my code :

CREATE DATABASE datalake_gold_db;

CREATE MASTER KEY ENCRYPTION BY PASSWORD ='Welcome@MS92';

CREATE DATABASE SCOPED CREDENTIAL MyCred

WITH IDENTITY='SHARED ACCESS SIGNATURE',

SECRET='SAS Token';

CREATE EXTERNAL DATA SOURCE silver_datalake

WITH (

LOCATION = 'abfss://******@talendazurestoragee.dfs.core.windows.net/silver',

CREDENTIAL=MyCred

);

-- Étape 2 : Créer le FILE FORMAT CSV (à faire une seule fois)

CREATE EXTERNAL FILE FORMAT csv_format

WITH (

FORMAT_TYPE = DELIMITEDTEXT,

FORMAT_OPTIONS (

FIELD_TERMINATOR = ',',

STRING_DELIMITER = '"',

FIRST_ROW = 2 -- car première ligne = en-tête

)

);

-- Création de la table externe traffic_gold

CREATE EXTERNAL TABLE traffic_gold (

frc VARCHAR(255),

currentSpeed INT,

freeFlowSpeed INT,

currentTravelTime INT,

freeFlowTravelTime INT,

confidence FLOAT,

roadClosure VARCHAR(255),

ville VARCHAR(255),

timestamp DATETIME,

congestionLevel INT,

isCongested VARCHAR(255)

)

WITH (

LOCATION = '/traffic/',

DATA_SOURCE = silver_datalake,

FILE_FORMAT = csv_format

);

-- Création de la table externe meteo_gold

CREATE EXTERNAL TABLE meteo_gold (

ville VARCHAR(255),

temperature FLOAT,

temperature_ressentie FLOAT,

temp_min FLOAT,

temp_max FLOAT,

pression INT,

humidite INT,

visibilite INT,

lat FLOAT,

lon FLOAT,

vent_vitesse FLOAT,

vent_direction INT,

condition VARCHAR(255),

description VARCHAR(255),

date DATETIME

)

WITH (

LOCATION = '/meteo/',

DATA_SOURCE = silver_datalake,

FILE_FORMAT = csv_format

);

-- Création de la table externe habitant_gold

CREATE EXTERNAL TABLE habitant_gold (

ville VARCHAR(255),

nombre_habitants INT,

type_agglomeration VARCHAR(255)

)

WITH (

LOCATION = '/data-nbhabitants-france/CitiesofFrance-VillesdeFrance.csv',

DATA_SOURCE = silver_datalake,

FILE_FORMAT = csv_format

);

-- Création de la table externe demographie_gold

CREATE EXTERNAL TABLE demographie_gold (

ville VARCHAR(255),

chomage FLOAT,

chomage_jeunes FLOAT,

chomage_long FLOAT,

evolu_emploi_cree FLOAT,

activite FLOAT,

emploi_feminin FLOAT,

emploi_commune FLOAT,

defaill_entreprise FLOAT,

salaire_annuel INT,

criminalite FLOAT,

evolution_crimes FLOAT,

securite_routiere FLOAT,

inondations INT,

terrains_pollues INT,

usines_risques INT,

mortalite_infantile FLOAT,

mortalite_cancer_poumon FLOAT,

mortalite_alcool FLOAT,

deces_infarctus FLOAT,

taux_suicide FLOAT,

mortalite_globale FLOAT,

taille_classes_primaires FLOAT,

retard_6eme FLOAT,

retard_3eme FLOAT,

retard_terminale FLOAT,

metre_carre_ancien INT,

taxe_habitation FLOAT,

foncier_bati FLOAT,

metre_cube_eau FLOAT,

proprietaires FLOAT,

logt_sup_4pieces FLOAT,

logt_insalubre FLOAT,

logt_vacant FLOAT,

logt_construction FLOAT,

mer INT,

ski INT,

soleil INT,

pluie FLOAT,

temperature FLOAT,

marche_a_pied FLOAT,

musees INT,

cinema FLOAT,

monum_historiques FLOAT,

pret_livres FLOAT,

restaur_distingues FLOAT,

presse FLOAT,

etudiants INT,

impot_revenu FLOAT,

impot_fortune FLOAT,

imposables FLOAT,

evol_demographique FLOAT,

vieillissement FLOAT,

attirance_globale FLOAT,

attirance_actifs FLOAT

)

WITH (

LOCATION = '/data-demographie-france/French_cities_2005.csv',

DATA_SOURCE = silver_datalake,

FILE_FORMAT = csv_format

);

I have the following error :

SELECT * FROM habitant_gold;
External table 'habitant_gold' is not accessible because location does not exist or it is used by another process.

I also grant the managed identity the "Storage Blob Data Contributor" role on the container that contains the external table, in the attached screen. I have a student account...

But I still have the same error... Can someone help me, please ?

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
5,306 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.