Skip to content

Commit 8141902

Browse files
authored
Merge pull request #153870 from saveenr/patch-105
Update get-started-analyze-sql-pool.md
2 parents ed67e17 + 7d48b90 commit 8141902

File tree

1 file changed

+47
-42
lines changed

1 file changed

+47
-42
lines changed

articles/synapse-analytics/get-started-analyze-sql-pool.md

Lines changed: 47 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -38,49 +38,54 @@ A dedicated SQL pool consumes billable resources as long as it's active. You can
3838
1. Select the pool 'SQLPOOL1' (pool created in [STEP 1](./get-started-create-workspace.md) of this tutorial) in 'Connect to' drop down list above the script.
3939
1. Enter the following code:
4040
```
41-
CREATE TABLE [dbo].[Trip]
42-
(
43-
[DateID] int NOT NULL,
44-
[MedallionID] int NOT NULL,
45-
[HackneyLicenseID] int NOT NULL,
46-
[PickupTimeID] int NOT NULL,
47-
[DropoffTimeID] int NOT NULL,
48-
[PickupGeographyID] int NULL,
49-
[DropoffGeographyID] int NULL,
50-
[PickupLatitude] float NULL,
51-
[PickupLongitude] float NULL,
52-
[PickupLatLong] varchar(50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
53-
[DropoffLatitude] float NULL,
54-
[DropoffLongitude] float NULL,
55-
[DropoffLatLong] varchar(50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
56-
[PassengerCount] int NULL,
57-
[TripDurationSeconds] int NULL,
58-
[TripDistanceMiles] float NULL,
59-
[PaymentType] varchar(50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
60-
[FareAmount] money NULL,
61-
[SurchargeAmount] money NULL,
62-
[TaxAmount] money NULL,
63-
[TipAmount] money NULL,
64-
[TollsAmount] money NULL,
65-
[TotalAmount] money NULL
66-
)
67-
WITH
68-
(
69-
DISTRIBUTION = ROUND_ROBIN,
70-
CLUSTERED COLUMNSTORE INDEX
71-
);
41+
IF NOT EXISTS (SELECT * FROM sys.objects O JOIN sys.schemas S ON O.schema_id = S.schema_id WHERE O.NAME = 'NYCTaxiTripSmall' AND O.TYPE = 'U' AND S.NAME = 'dbo')
42+
CREATE TABLE dbo.NYCTaxiTripSmall
43+
(
44+
[DateID] int,
45+
[MedallionID] int,
46+
[HackneyLicenseID] int,
47+
[PickupTimeID] int,
48+
[DropoffTimeID] int,
49+
[PickupGeographyID] int,
50+
[DropoffGeographyID] int,
51+
[PickupLatitude] float,
52+
[PickupLongitude] float,
53+
[PickupLatLong] nvarchar(4000),
54+
[DropoffLatitude] float,
55+
[DropoffLongitude] float,
56+
[DropoffLatLong] nvarchar(4000),
57+
[PassengerCount] int,
58+
[TripDurationSeconds] int,
59+
[TripDistanceMiles] float,
60+
[PaymentType] nvarchar(4000),
61+
[FareAmount] numeric(19,4),
62+
[SurchargeAmount] numeric(19,4),
63+
[TaxAmount] numeric(19,4),
64+
[TipAmount] numeric(19,4),
65+
[TollsAmount] numeric(19,4),
66+
[TotalAmount] numeric(19,4)
67+
)
68+
WITH
69+
(
70+
DISTRIBUTION = ROUND_ROBIN,
71+
CLUSTERED COLUMNSTORE INDEX
72+
-- HEAP
73+
)
74+
GO
7275
73-
COPY INTO [dbo].[Trip]
74-
FROM 'https://nytaxiblob.blob.core.windows.net/2013/Trip2013/QID6392_20171107_05910_0.txt.gz'
75-
WITH
76-
(
77-
FILE_TYPE = 'CSV',
78-
FIELDTERMINATOR = '|',
79-
FIELDQUOTE = '',
80-
ROWTERMINATOR='0X0A',
81-
COMPRESSION = 'GZIP'
82-
)
83-
OPTION (LABEL = 'COPY : Load [dbo].[Trip] - Taxi dataset');
76+
--Uncomment the 4 lines below to create a stored procedure for data pipeline orchestration​
77+
--CREATE PROC bulk_load_NYCTaxiTripSmall
78+
--AS
79+
--BEGIN
80+
COPY INTO dbo.NYCTaxiTripSmall
81+
(DateID 1, MedallionID 2, HackneyLicenseID 3, PickupTimeID 4, DropoffTimeID 5, PickupGeographyID 6, DropoffGeographyID 7, PickupLatitude 8, PickupLongitude 9, PickupLatLong 10, DropoffLatitude 11, DropoffLongitude 12, DropoffLatLong 13, PassengerCount 14, TripDurationSeconds 15, TripDistanceMiles 16, PaymentType 17, FareAmount 18, SurchargeAmount 19, TaxAmount 20, TipAmount 21, TollsAmount 22, TotalAmount 23)
82+
FROM 'https://contosolake.dfs.core.windows.net/users/NYCTripSmall.parquet'
83+
WITH
84+
(
85+
FILE_TYPE = 'PARQUET'
86+
,MAXERRORS = 0
87+
,IDENTITY_INSERT = 'OFF'
88+
)
8489
```
8590
1. Click the Run button to execute the script.
8691
1. This script will finish in less than 60 seconds. It loads 2 million rows of NYC Taxi data into a table called **dbo.Trip**.

0 commit comments

Comments
 (0)