1. Giới thiệu
Trong lớp học lập trình này, bạn sẽ xây dựng một hệ thống tìm kiếm và đề xuất phiên hội nghị thông minh bằng cách sử dụng AlloyDB cho PostgreSQL và các chức năng AI của hệ thống này. Bạn sẽ khám phá cách kết hợp tìm kiếm từ khoá truyền thống với tìm kiếm vectơ ngữ nghĩa nâng cao, sử dụng QueryData để tạo các câu lệnh SQL có thể dự đoán từ ngôn ngữ tự nhiên và tận dụng các hàm toán tử thông minh.
Bạn sẽ thực hiện
- Triển khai một cụm AlloyDB và bật các chức năng AI.
- Tải Tập dữ liệu hội nghị và tìm hiểu cấu trúc của tập dữ liệu đó.
- Bật AlloyDB API truy cập dữ liệu
- Sử dụng Các toán tử AI của AlloyDB như
ai.ifvàai.rankcho các thao tác ngữ nghĩa. - Triển khai tính năng Tìm kiếm kết hợp kết hợp các cụm từ tìm kiếm bằng vectơ ngữ nghĩa (ScaNN) và văn bản (RUM).
- Bật QueryData cho AlloyDB
- Tạo mẫu QueryData
- Sử dụng QueryData với tác nhân AI
Bạn cần có
- Một trình duyệt web như Chrome
- Một dự án trên Google Cloud đã bật tính năng thanh toán
Lớp học lập trình này dành cho nhà phát triển ở mọi cấp độ, kể cả người mới bắt đầu.
Tổng thời lượng ước tính: 60 – 70 phút. Chi phí ước tính: Dưới 30.000 VND (các tài nguyên được tạo trong lớp học lập trình này đủ điều kiện sử dụng bậc miễn phí tiêu chuẩn hoặc dùng thử).
2. Thiết lập và yêu cầu
Thiết lập dự án
Đăng nhập vào Google Cloud Console. Nếu chưa có tài khoản Gmail hoặc Google Workspace, bạn phải tạo một tài khoản.
Sử dụng tài khoản cá nhân thay vì tài khoản trường học hoặc tài khoản do nơi làm việc cấp.
Tạo một dự án trên Google Cloud
- Trong Google Cloud Console, trên trang chọn dự án, hãy chọn hoặc tạo một dự án trên Google Cloud.
- Đảm bảo bạn đã bật tính năng thanh toán cho dự án trên Cloud. Tìm hiểu cách kiểm tra xem tính năng thanh toán có được bật trên một dự án hay không.
Khởi động Cloud Shell
Mặc dù có thể vận hành Google Cloud từ xa trên máy tính xách tay, nhưng trong lớp học lập trình này, bạn sẽ sử dụng Google Cloud Shell, một môi trường dòng lệnh chạy trên Cloud.
- Nhấp vào Kích hoạt Cloud Shell ở đầu bảng điều khiển Cloud.
- Xác minh hoạt động xác thực:
gcloud auth list
- Xác nhận dự án của bạn:
gcloud config get project
- Đặt nếu cần:
export PROJECT_ID=<YOUR_PROJECT_ID>
gcloud config set project $PROJECT_ID
3. Trước khi bắt đầu
Bật API
Chạy lệnh này để bật tất cả các API bắt buộc:
gcloud services enable alloydb.googleapis.com \
compute.googleapis.com \
cloudresourcemanager.googleapis.com \
servicenetworking.googleapis.com \
aiplatform.googleapis.com \
geminidataanalytics.googleapis.com
Giới thiệu về các API
- API AlloyDB (
alloydb.googleapis.com) cho phép bạn tạo, quản lý và mở rộng quy mô các cụm AlloyDB cho PostgreSQL. Đây là một dịch vụ cơ sở dữ liệu tương thích với PostgreSQL, được quản lý hoàn toàn và được thiết kế cho các tải công việc giao dịch và phân tích đòi hỏi khắt khe của doanh nghiệp. - Compute Engine API (
compute.googleapis.com) cho phép bạn tạo và quản lý máy ảo (VM), ổ đĩa liên tục và chế độ cài đặt mạng. Nền tảng này cung cấp nền tảng Cơ sở hạ tầng dưới dạng dịch vụ (IaaS) cốt lõi cần thiết để chạy các khối lượng công việc và lưu trữ cơ sở hạ tầng cơ bản cho nhiều dịch vụ được quản lý. - Cloud Resource Manager API (
cloudresourcemanager.googleapis.com) cho phép bạn quản lý siêu dữ liệu và cấu hình của dự án trên Google Cloud theo phương thức lập trình. Việc này giúp bạn sắp xếp tài nguyên, xử lý các chính sách Quản lý danh tính và quyền truy cập (IAM) cũng như xác thực các quyền trong hệ thống phân cấp dự án. - Service Networking API (
servicenetworking.googleapis.com) cho phép bạn tự động hoá việc thiết lập kết nối riêng tư giữa mạng Virtual Private Cloud (VPC) và các dịch vụ được quản lý của Google. Bạn cần phải thiết lập quyền truy cập bằng IP riêng tư cho các dịch vụ như AlloyDB để các dịch vụ này có thể giao tiếp an toàn với các tài nguyên khác của bạn. - Vertex AI API (
aiplatform.googleapis.com) cho phép các ứng dụng của bạn xây dựng, triển khai và mở rộng quy mô các mô hình học máy. Vertex AI cung cấp giao diện hợp nhất cho tất cả các dịch vụ AI của Google Cloud, bao gồm cả quyền truy cập vào các mô hình AI tạo sinh (như Gemini) và hoạt động huấn luyện mô hình tuỳ chỉnh. - Data Analytics API (
geminidataanalytics.googleapis.com) cho phép ứng dụng của bạn sử dụng các chức năng AI chung trong các sản phẩm BI.
4. Cấp phép AlloyDB
Tạo một cụm AlloyDB và phiên bản chính.
Tạo dải IP riêng tư
AlloyDB yêu cầu phải có một dải IP riêng tư trong VPC của bạn. Giả sử bạn đang sử dụng mạng VPC default:
- Tạo dải IP riêng tư:
gcloud compute addresses create psa-range \
--global \
--purpose=VPC_PEERING \
--prefix-length=24 \
--description="VPC private service access" \
--network=default
- Thiết lập kết nối riêng tư:
gcloud services vpc-peerings connect \
--service=servicenetworking.googleapis.com \
--ranges=psa-range \
--network=default
Tạo cụm AlloyDB
- Tạo mật khẩu cho người dùng
postgres:
export PGPASSWORD=`openssl rand -hex 12`
echo $PGPASSWORD
- Tạo một Cụm dùng thử miễn phí ("TRIAL") hoặc một cụm tiêu chuẩn ("STANDARD") nếu đây không phải là lần đầu tiên bạn tạo:
export REGION=us-central1
export ADBCLUSTER=alloydb-next26-ai-demo-01
gcloud alloydb clusters create $ADBCLUSTER \
--password=$PGPASSWORD \
--network=default \
--region=$REGION \
--subscription-type=TRIAL
- Tạo phiên bản chính:
gcloud alloydb instances create $ADBCLUSTER-pr \
--instance-type=PRIMARY \
--cpu-count=8 \
--region=$REGION \
--cluster=$ADBCLUSTER
5. Thiết lập quyền đối với cơ sở dữ liệu
Bật quyền Vertex AI để tạo nội dung nhúng
PROJECT_ID=$(gcloud config get-value project)
gcloud projects add-iam-policy-binding $PROJECT_ID \
--member="serviceAccount:service-$(gcloud projects describe $PROJECT_ID --format="value(projectNumber)")@gcp-sa-alloydb.iam.gserviceaccount.com" \
--role="roles/aiplatform.user"
Bật Data Access API
Bạn cần bật Data Access API trên cụm AlloyDB để có thể sử dụng ngữ cảnh QueryData nhằm tạo các mẫu giúp tạo câu lệnh SQL có thể dự đoán từ ngôn ngữ tự nhiên.
Trong cùng một thẻ thiết bị đầu cuối, hãy thực thi:
PROJECT_ID=$(gcloud config get-value project)
REGION=us-central1
ADBCLUSTER=alloydb-next26-ai-demo-01
curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
https://alloydb.googleapis.com/v1alpha/projects/$PROJECT_ID/locations/$REGION/clusters/$ADBCLUSTER/instances/$ADBCLUSTER-pr?updateMask=dataApiAccess \
-d '{
"dataApiAccess": "ENABLED",
}'
Bật tính năng xác thực IAM
Đối với các công cụ dựa trên tác nhân, bạn phải bật tính năng xác thực IAM trên phiên bản rồi thêm chính mình làm người dùng.
Bật IAM trên phiên bản bằng cách thực thi lệnh sau trong cùng một thẻ của thiết bị đầu cuối:
PROJECT_ID=$(gcloud config get-value project)
REGION=us-central1
ADBCLUSTER=alloydb-next26-ai-demo-01
gcloud beta alloydb instances update $ADBCLUSTER-pr \
--database-flags alloydb.iam_authentication=on \
--region=$REGION \
--cluster=$ADBCLUSTER \
--project=$PROJECT_ID \
--update-mode=FORCE_APPLY
Thêm chính bạn làm người dùng AlloyDB:
REGION=us-central1
ADBCLUSTER=alloydb-next26-ai-demo-01
gcloud alloydb users create $(gcloud config get-value account) \
--cluster=$ADBCLUSTER \
--region=$REGION \
--type=IAM_BASED \
--db-roles=alloydbsuperuser
6. Chuẩn bị cơ sở dữ liệu mẫu
Kết nối với AlloyDB Studio
- Chuyển đến trang AlloyDB for Postgres trong Google Cloud Console.
- Nhấp vào phiên bản chính của bạn.
- Trên bảng điều hướng bên trái, hãy nhấp vào AlloyDB Studio.
- Chọn cơ sở dữ liệu
postgres - Xác thực bằng
IAM database authentication
Tạo cơ sở dữ liệu
Chạy SQL sau trong trình chỉnh sửa truy vấn:
CREATE DATABASE conference_db;
Chuyển sang cơ sở dữ liệu conference_db bằng cách:
- Nhấp vào nút
Current userở trên cùng bên trái của màn hìnhAlloyDB studio - Nhấp vào nút
Switch user/database - Chọn cơ sở dữ liệu
conference_dbvừa tạo.
Bật pgvector
Đảm bảo bạn đã bật tiện ích vector tiêu chuẩn:
CREATE EXTENSION IF NOT EXISTS vector;
Tải dữ liệu mẫu
Chạy các tập lệnh SQL sau để tạo giản đồ và điền dữ liệu mẫu vào giản đồ đó:
1. Dọn dẹp mọi bảng xung đột trước đó
DROP TABLE IF EXISTS public.attendees_sessions CASCADE;
DROP TABLE IF EXISTS public.session_speaker_mapping CASCADE;
DROP TABLE IF EXISTS public.session_topic_mapping CASCADE;
DROP TABLE IF EXISTS public.session CASCADE;
DROP TABLE IF EXISTS public.attendees CASCADE;
DROP TABLE IF EXISTS public.speaker CASCADE;
DROP TABLE IF EXISTS public.session_topic CASCADE;
2. Tạo bảng
CREATE TABLE public.attendees (
username character varying(100) NOT NULL PRIMARY KEY,
name character varying(100),
company character varying(150),
job_title character varying(100),
area_of_interest character varying(100),
street_address text,
city character varying(100),
state_province character varying(100),
country character varying(100),
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE public.attendees_sessions (
username character varying(100) NOT NULL REFERENCES public.attendees(username),
session_id character varying(50) NOT NULL,
registration_date timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (username, session_id)
);
CREATE TABLE public.session (
session_id character varying(50) NOT NULL PRIMARY KEY,
session_name character varying(255) NOT NULL,
full_description text,
full_description_embedding vector(768) GENERATED ALWAYS AS (embedding('text-embedding-005', full_description)) STORED,
description_tsvector tsvector GENERATED ALWAYS AS (to_tsvector('english', full_description)) STORED,
session_format character varying(50),
learning_level character varying(50),
session_url character varying(255),
for_job_role character varying(250),
session_date date,
session_start_time time without time zone,
session_end_time time without time zone,
session_location character varying(100),
capacity integer,
remaining_capacity integer,
interest_area character varying(100),
industry character varying(100)
);
COMMENT ON COLUMN public.session.session_format IS 'The format of a session. Possible values are Keynotes, Breakouts, Lightning Talks.';
CREATE TABLE public.speaker (
speaker_id integer NOT NULL PRIMARY KEY,
speaker_name character varying(100) NOT NULL,
job_title character varying(100),
company character varying(100),
type character varying(50),
profile_pic character varying(100),
speaker_url character varying(100)
);
CREATE TABLE public.session_speaker_mapping (
session_id character varying(50) NOT NULL REFERENCES public.session(session_id),
speaker_id integer NOT NULL REFERENCES public.speaker(speaker_id),
PRIMARY KEY (session_id, speaker_id)
);
CREATE TABLE public.session_topic (
topic character varying(100) NOT NULL PRIMARY KEY,
topic_desc text,
embedding vector(768) GENERATED ALWAYS AS (embedding('text-embedding-005', topic_desc)) STORED
);
CREATE TABLE public.session_topic_mapping (
session_id character varying(50) NOT NULL REFERENCES public.session(session_id),
topic character varying(100) NOT NULL REFERENCES public.session_topic(topic),
PRIMARY KEY (session_id, topic)
);
3. Điền dữ liệu mẫu vào các bảng
3.1 Điền chủ đề của phiên
-- Insert Topics
INSERT INTO public.session_topic (topic, topic_desc) VALUES
('Databases', 'Relational and non-relational database technologies.'),
('AI & Machine Learning', 'Generative AI, LLMs, and ML infrastructure.'),
('Cloud Architecture', 'Designing scalable and resilient cloud systems.'),
('Security', 'Identity, compliance, and network security.'),
('DevOps', 'CI/CD, platform engineering, and automation.') ON CONFLICT DO NOTHING;
3.2 Điền sẵn thông tin về diễn giả
-- Insert Speakers
INSERT INTO public.speaker (speaker_id, speaker_name, job_title, company, type, profile_pic, speaker_url) VALUES
(1, 'Speaker 1', 'Director of Engineering', 'DeepMind', 'External', 'pic_1.png', 'http://speakers.com/1'),
(2, 'Speaker 2', 'Cloud Architect', 'Verily', 'External', 'pic_2.png', 'http://speakers.com/2'),
(3, 'Speaker 3', 'Product Manager', 'GlobalEnterprises', 'External', 'pic_3.png', 'http://speakers.com/3'),
(4, 'Speaker 4', 'Tech Lead', 'Google', 'Internal', 'pic_4.png', 'http://speakers.com/4'),
(5, 'Speaker 5', 'Security Engineer', 'DeepMind', 'External', 'pic_5.png', 'http://speakers.com/5'),
(6, 'Speaker 6', 'DevOps Engineer', 'DeepMind', 'External', 'pic_6.png', 'http://speakers.com/6'),
(7, 'Speaker 7', 'Product Manager', 'DataSystems', 'External', 'pic_7.png', 'http://speakers.com/7'),
(8, 'Speaker 8', 'Director of Engineering', 'Google', 'Internal', 'pic_8.png', 'http://speakers.com/8'),
(9, 'Speaker 9', 'Cloud Architect', 'Google', 'Internal', 'pic_9.png', 'http://speakers.com/9'),
(10, 'Speaker 10', 'DevOps Engineer', 'Alphabet', 'Internal', 'pic_10.png', 'http://speakers.com/10'),
(11, 'Speaker 11', 'Tech Lead', 'Alphabet', 'External', 'pic_11.png', 'http://speakers.com/11'),
(12, 'Speaker 12', 'Product Manager', 'Alphabet', 'External', 'pic_12.png', 'http://speakers.com/12'),
(13, 'Speaker 13', 'Tech Lead', 'SoftSolutions', 'Internal', 'pic_13.png', 'http://speakers.com/13'),
(14, 'Speaker 14', 'Director of Engineering', 'Verily', 'Internal', 'pic_14.png', 'http://speakers.com/14'),
(15, 'Speaker 15', 'DevOps Engineer', 'CloudNative', 'External', 'pic_15.png', 'http://speakers.com/15'),
(16, 'Speaker 16', 'Software Engineer', 'Waymo', 'External', 'pic_16.png', 'http://speakers.com/16'),
(17, 'Speaker 17', 'DevOps Engineer', 'Google', 'External', 'pic_17.png', 'http://speakers.com/17'),
(18, 'Speaker 18', 'Data Scientist', 'GlobalEnterprises', 'External', 'pic_18.png', 'http://speakers.com/18'),
(19, 'Speaker 19', 'Security Engineer', 'Waymo', 'Internal', 'pic_19.png', 'http://speakers.com/19'),
(20, 'Speaker 20', 'Tech Lead', 'SoftSolutions', 'Internal', 'pic_20.png', 'http://speakers.com/20') ON CONFLICT (speaker_id) DO NOTHING;
3.3 Điền sẵn khách tham dự
-- Insert Attendees
INSERT INTO public.attendees (username, name, company, job_title, area_of_interest, street_address, city, state_province, country) VALUES
('user_1', 'Attendee 1', 'GlobalEnterprises', 'Data Scientist', 'DevOps', '1 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_2', 'Attendee 2', 'Alphabet', 'Director of Engineering', 'DevOps', '2 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_3', 'Attendee 3', 'CloudNative', 'Data Scientist', 'AI & Machine Learning', '3 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_4', 'Attendee 4', 'SoftSolutions', 'Product Manager', 'DevOps', '4 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_5', 'Attendee 5', 'DataSystems', 'Software Engineer', 'DevOps', '5 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_6', 'Attendee 6', 'Google', 'Director of Engineering', 'Security', '6 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_7', 'Attendee 7', 'Waymo', 'Product Manager', 'AI & Machine Learning', '7 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_8', 'Attendee 8', 'Verily', 'Product Manager', 'DevOps', '8 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_9', 'Attendee 9', 'Waymo', 'Software Engineer', 'DevOps', '9 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_10', 'Attendee 10', 'Waymo', 'DevOps Engineer', 'Databases', '10 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_11', 'Attendee 11', 'GlobalEnterprises', 'Tech Lead', 'Cloud Architecture', '11 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_12', 'Attendee 12', 'Google', 'Tech Lead', 'DevOps', '12 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_13', 'Attendee 13', 'DeepMind', 'Software Engineer', 'Cloud Architecture', '13 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_14', 'Attendee 14', 'DataSystems', 'Security Engineer', 'DevOps', '14 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_15', 'Attendee 15', 'DeepMind', 'Security Engineer', 'Cloud Architecture', '15 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_16', 'Attendee 16', 'Verily', 'Security Engineer', 'Cloud Architecture', '16 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_17', 'Attendee 17', 'Google', 'Software Engineer', 'Cloud Architecture', '17 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_18', 'Attendee 18', 'GlobalEnterprises', 'Security Engineer', 'DevOps', '18 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_19', 'Attendee 19', 'CloudNative', 'Data Scientist', 'Databases', '19 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_20', 'Attendee 20', 'DataSystems', 'Cloud Architect', 'AI & Machine Learning', '20 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_21', 'Attendee 21', 'Google', 'Data Scientist', 'Databases', '21 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_22', 'Attendee 22', 'TechCorp', 'Data Scientist', 'DevOps', '22 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_23', 'Attendee 23', 'DeepMind', 'Product Manager', 'Databases', '23 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_24', 'Attendee 24', 'Google', 'Cloud Architect', 'AI & Machine Learning', '24 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_25', 'Attendee 25', 'GlobalEnterprises', 'Software Engineer', 'AI & Machine Learning', '25 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_26', 'Attendee 26', 'Verily', 'Security Engineer', 'Security', '26 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_27', 'Attendee 27', 'GlobalEnterprises', 'Tech Lead', 'Databases', '27 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_28', 'Attendee 28', 'Google', 'Tech Lead', 'Databases', '28 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_29', 'Attendee 29', 'SoftSolutions', 'Software Engineer', 'Databases', '29 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_30', 'Attendee 30', 'Verily', 'DevOps Engineer', 'Databases', '30 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_31', 'Attendee 31', 'DeepMind', 'Data Scientist', 'Databases', '31 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_32', 'Attendee 32', 'SoftSolutions', 'Software Engineer', 'Cloud Architecture', '32 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_33', 'Attendee 33', 'DeepMind', 'Tech Lead', 'Databases', '33 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_34', 'Attendee 34', 'Alphabet', 'Security Engineer', 'DevOps', '34 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_35', 'Attendee 35', 'TechCorp', 'DevOps Engineer', 'Cloud Architecture', '35 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_36', 'Attendee 36', 'DataSystems', 'Director of Engineering', 'Security', '36 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_37', 'Attendee 37', 'Google', 'Cloud Architect', 'Databases', '37 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_38', 'Attendee 38', 'Google', 'Product Manager', 'Security', '38 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_39', 'Attendee 39', 'SoftSolutions', 'Security Engineer', 'Cloud Architecture', '39 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_40', 'Attendee 40', 'Waymo', 'Director of Engineering', 'Cloud Architecture', '40 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_41', 'Attendee 41', 'SoftSolutions', 'Tech Lead', 'Security', '41 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_42', 'Attendee 42', 'DeepMind', 'Cloud Architect', 'Security', '42 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_43', 'Attendee 43', 'TechCorp', 'Cloud Architect', 'Databases', '43 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_44', 'Attendee 44', 'Alphabet', 'Security Engineer', 'AI & Machine Learning', '44 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_45', 'Attendee 45', 'CloudNative', 'Cloud Architect', 'AI & Machine Learning', '45 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_46', 'Attendee 46', 'CloudNative', 'Data Scientist', 'Security', '46 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_47', 'Attendee 47', 'DeepMind', 'Data Scientist', 'Security', '47 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_48', 'Attendee 48', 'Verily', 'DevOps Engineer', 'AI & Machine Learning', '48 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_49', 'Attendee 49', 'Verily', 'Director of Engineering', 'AI & Machine Learning', '49 Main St', 'CityVille', 'StateName', 'CountryName'),
('user_50', 'Attendee 50', 'Google', 'Director of Engineering', 'DevOps', '50 Main St', 'CityVille', 'StateName', 'CountryName') ON CONFLICT (username) DO NOTHING;
3.4 Điền sẵn các phiên
-- Insert Sessions
INSERT INTO public.session (session_id, session_name, full_description, session_format, learning_level, session_url, for_job_role, session_date, session_start_time, session_end_time, session_location, capacity, remaining_capacity, interest_area, industry) VALUES
('S001', 'AlloyDB Deep Dive: Advanced Performance Tuning', 'Learn how to squeeze every drop of performance out of AlloyDB. This session covers index tuning, memory management, and advanced query optimization techniques.', 'Lightning Talks', 'Beginner', 'http://sessions.com/S001', 'Cloud Architect', '2026-04-11', '15:00:00', '15:00:00', 'Room C', 500, 192, 'Databases', 'Technology'),
('S002', 'Vector Search at Scale with ScaNN in AlloyDB', 'Discover how to use ScaNN for fast approximate nearest neighbor search in AlloyDB. Perfect for building high-scale recommendation systems.', 'Breakouts', 'Intermediate', 'http://sessions.com/S002', 'Cloud Architect', '2026-04-10', '14:00:00', '14:00:00', 'Auditorium', 100, 16, 'Databases', 'Retail'),
('S003', 'Building Gen AI Apps with Vertex AI and AlloyDB', 'A practical guide to integrating Vertex AI embeddings and LLMs with your operational data in AlloyDB to build intelligent applications.', 'Lightning Talks', 'Advanced', 'http://sessions.com/S003', 'Director of Engineering', '2026-04-11', '11:00:00', '11:00:00', 'Auditorium', 50, 28, 'Databases', 'Healthcare'),
('S004', 'Spanner: Architecting for Global Consistency', 'Learn how Spanner achieves global scale without sacrificing strong consistency. We will cover multi-region deployment patterns.', 'Keynotes', 'Intermediate', 'http://sessions.com/S004', 'Cloud Architect', '2026-04-11', '11:00:00', '11:00:00', 'Room B', 500, 441, 'Databases', 'Healthcare'),
('S005', 'BigQuery + Vertex AI: Predictive Analytics Made Easy', 'See how to combine the power of BigQuery for data warehousing with Vertex AI for machine learning to build predictive models directly on your data.', 'Breakouts', 'Advanced', 'http://sessions.com/S005', 'Product Manager', '2026-04-11', '14:00:00', '14:00:00', 'Room C', 100, 96, 'AI & Machine Learning', 'Retail'),
('S006', 'Securing Your Data: Best Practices in AlloyDB', 'Deep dive into the security features of AlloyDB, including IAM integration, encryption at rest and in transit, and audit logging.', 'Keynotes', 'Beginner', 'http://sessions.com/S006', 'Product Manager', '2026-04-09', '15:00:00', '15:00:00', 'Room C', 200, 199, 'Databases', 'Healthcare'),
('S007', 'Kubernetes for Databases: Running PostgreSQL on GKE', 'Best practices for running stateful workloads like PostgreSQL on Google Kubernetes Engine (GKE).', 'Lightning Talks', 'Intermediate', 'http://sessions.com/S007', 'Software Engineer', '2026-04-09', '16:00:00', '16:00:00', 'Room C', 100, 63, 'Databases', 'Retail'),
('S008', 'Real-time Analytics with BigQuery and Pub/Sub', 'Learn how to build real-time data pipelines using Pub/Sub and stream data directly into BigQuery for instant insights.', 'Keynotes', 'Beginner', 'http://sessions.com/S008', 'Security Engineer', '2026-04-10', '14:00:00', '14:00:00', 'Room C', 200, 65, 'Databases', 'Finance'),
('S009', 'Microservices Architecture with Spanner', 'How to design microservices that leverage Spanner''s unique capabilities for distributed transactions and scalability.', 'Keynotes', 'Beginner', 'http://sessions.com/S009', 'Software Engineer', '2026-04-11', '10:00:00', '10:00:00', 'Auditorium', 100, 25, 'Databases', 'Technology'),
('S010', 'AI-Powered Search with ScaNN and LLMs', 'Learn how to combine ScaNN vector search with Large Language Models to create powerful, context-aware search experiences.', 'Keynotes', 'Intermediate', 'http://sessions.com/S010', 'Tech Lead', '2026-04-11', '11:00:00', '11:00:00', 'Room C', 50, 27, 'AI & Machine Learning', 'Healthcare'),
('S011', 'AlloyDB Omni: Run AlloyDB Anywhere', 'Explore AlloyDB Omni, the downloadable edition of AlloyDB that lets you run the same high-performance database in your own data center or on the edge.', 'Breakouts', 'Intermediate', 'http://sessions.com/S011', 'Cloud Architect', '2026-04-09', '10:00:00', '10:00:00', 'Room B', 200, 195, 'Databases', 'Technology'),
('S012', 'Data Mesh on Google Cloud: Best Practices', 'How to implement a decentralized data mesh architecture using BigQuery, Dataplex, and other Google Cloud tools.', 'Lightning Talks', 'Intermediate', 'http://sessions.com/S012', 'Data Scientist', '2026-04-10', '16:00:00', '16:00:00', 'Room C', 100, 46, 'Cloud Architecture', 'Technology'),
('S013', 'Serverless Databases: When to use Cloud SQL vs AlloyDB', 'A comparison of Cloud SQL and AlloyDB, helping you choose the right database for your serverless and traditional applications.', 'Lightning Talks', 'Beginner', 'http://sessions.com/S013', 'DevOps Engineer', '2026-04-10', '11:00:00', '11:00:00', 'Room C', 500, 458, 'Databases', 'Manufacturing'),
('S014', 'Graph Databases on Google Cloud', 'Explore options for graph data processing on Google Cloud, including integrations with existing database services.', 'Breakouts', 'Advanced', 'http://sessions.com/S014', 'DevOps Engineer', '2026-04-11', '09:00:00', '09:00:00', 'Room C', 500, 338, 'DevOps', 'Finance'),
('S015', 'Automating DB Ops with Gemini', 'See how Gemini can help DBA and developers write better SQL, optimize queries, and manage database infrastructure.', 'Breakouts', 'Advanced', 'http://sessions.com/S015', 'Cloud Architect', '2026-04-11', '14:00:00', '14:00:00', 'Room C', 100, 53, 'AI & Machine Learning', 'Retail'),
('S016', 'High Availability and Disaster Recovery in AlloyDB', 'A deep dive into how AlloyDB ensures your data is always available, covering failover mechanisms and backup strategies.', 'Breakouts', 'Advanced', 'http://sessions.com/S016', 'Cloud Architect', '2026-04-11', '11:00:00', '11:00:00', 'Room A', 200, 52, 'Databases', 'Technology'),
('S017', 'Optimizing Costs in BigQuery', 'Practical tips for reducing your BigQuery bill without sacrificing performance, covering slot management and query optimization.', 'Lightning Talks', 'Beginner', 'http://sessions.com/S017', 'Security Engineer', '2026-04-11', '15:00:00', '15:00:00', 'Room B', 100, 65, 'Databases', 'Manufacturing'),
('S018', 'Continuous Integration for Database Schemas', 'How to apply CI/CD principles to database schema changes using tools like Liquibase or Flyway on Google Cloud.', 'Breakouts', 'Beginner', 'http://sessions.com/S018', 'Cloud Architect', '2026-04-11', '09:00:00', '09:00:00', 'Room B', 50, 30, 'Security', 'Technology'),
('S019', 'Data Governance in the Age of AI', 'Learn how to maintain data quality, privacy, and compliance when feeding enterprise data into AI models.', 'Breakouts', 'Beginner', 'http://sessions.com/S019', 'Product Manager', '2026-04-10', '10:00:00', '10:00:00', 'Room A', 100, 39, 'DevOps', 'Retail'),
('S020', 'Hybrid Search: Combining Vector and Keyword Search', 'Learn how to implement hybrid search in AlloyDB to get the best of both worlds: semantic understanding and precise keyword matching.', 'Breakouts', 'Intermediate', 'http://sessions.com/S020', 'Data Scientist', '2026-04-09', '14:00:00', '14:00:00', 'Auditorium', 500, 176, 'Databases', 'Manufacturing'),
('S021', 'Deep Dive into ScaNN for High Availability', 'Join this session to explore how ScaNN can be used for High Availability. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Advanced', 'http://sessions.com/S021', 'Software Engineer', '2026-04-11', '14:00:00', '14:00:00', 'Room B', 200, 18, 'AI & Machine Learning', 'Finance'),
('S022', 'Understanding Vertex AI for Modernization', 'Join this session to explore how Vertex AI can be used for Modernization. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Beginner', 'http://sessions.com/S022', 'Tech Lead', '2026-04-09', '09:00:00', '09:00:00', 'Room A', 50, 48, 'AI & Machine Learning', 'Finance'),
('S023', 'Securing Vertex AI for Modernization', 'Join this session to explore how Vertex AI can be used for Modernization. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Intermediate', 'http://sessions.com/S023', 'Tech Lead', '2026-04-10', '10:00:00', '10:00:00', 'Auditorium', 200, 96, 'AI & Machine Learning', 'Manufacturing'),
('S024', 'Mastering Kubernetes for Security', 'Join this session to explore how Kubernetes can be used for Security. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Beginner', 'http://sessions.com/S024', 'DevOps Engineer', '2026-04-09', '09:00:00', '09:00:00', 'Auditorium', 200, 160, 'Security', 'Technology'),
('S025', 'Mastering AlloyDB for Modernization', 'Join this session to explore how AlloyDB can be used for Modernization. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Advanced', 'http://sessions.com/S025', 'Director of Engineering', '2026-04-11', '16:00:00', '16:00:00', 'Room B', 200, 74, 'Databases', 'Healthcare'),
('S026', 'Securing Vertex AI for Automation', 'Join this session to explore how Vertex AI can be used for Automation. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Advanced', 'http://sessions.com/S026', 'Cloud Architect', '2026-04-11', '16:00:00', '16:00:00', 'Room A', 50, 25, 'AI & Machine Learning', 'Manufacturing'),
('S027', 'Mastering BigQuery for Analytics', 'Join this session to explore how BigQuery can be used for Analytics. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Intermediate', 'http://sessions.com/S027', 'Security Engineer', '2026-04-11', '10:00:00', '10:00:00', 'Room B', 200, 117, 'Databases', 'Healthcare'),
('S028', 'Deep Dive into Spanner for Integration', 'Join this session to explore how Spanner can be used for Integration. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Advanced', 'http://sessions.com/S028', 'Tech Lead', '2026-04-09', '10:00:00', '10:00:00', 'Auditorium', 50, 32, 'Databases', 'Retail'),
('S029', 'Scaling Generative AI for Automation', 'Join this session to explore how Generative AI can be used for Automation. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Intermediate', 'http://sessions.com/S029', 'Tech Lead', '2026-04-09', '10:00:00', '10:00:00', 'Room A', 200, 157, 'AI & Machine Learning', 'Healthcare'),
('S030', 'Deploying Generative AI for Analytics', 'Join this session to explore how Generative AI can be used for Analytics. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Advanced', 'http://sessions.com/S030', 'Director of Engineering', '2026-04-09', '16:00:00', '16:00:00', 'Room B', 500, 462, 'DevOps', 'Healthcare'),
('S031', 'Mastering ScaNN for High Availability', 'Join this session to explore how ScaNN can be used for High Availability. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Beginner', 'http://sessions.com/S031', 'Director of Engineering', '2026-04-10', '09:00:00', '09:00:00', 'Room C', 500, 140, 'AI & Machine Learning', 'Finance'),
('S032', 'Deploying Kubernetes for Integration', 'Join this session to explore how Kubernetes can be used for Integration. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Advanced', 'http://sessions.com/S032', 'Cloud Architect', '2026-04-11', '14:00:00', '14:00:00', 'Auditorium', 200, 22, 'Databases', 'Retail'),
('S033', 'Securing Gemini for Performance', 'Join this session to explore how Gemini can be used for Performance. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Intermediate', 'http://sessions.com/S033', 'Cloud Architect', '2026-04-09', '16:00:00', '16:00:00', 'Room B', 200, 84, 'AI & Machine Learning', 'Technology'),
('S034', 'Deploying Vertex AI for Scale', 'Join this session to explore how Vertex AI can be used for Scale. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Intermediate', 'http://sessions.com/S034', 'Director of Engineering', '2026-04-10', '10:00:00', '10:00:00', 'Room B', 500, 222, 'AI & Machine Learning', 'Finance'),
('S035', 'Deep Dive into BigQuery for Analytics', 'Join this session to explore how BigQuery can be used for Analytics. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Intermediate', 'http://sessions.com/S035', 'Security Engineer', '2026-04-11', '15:00:00', '15:00:00', 'Room A', 500, 408, 'Databases', 'Healthcare'),
('S036', 'Deploying Kubernetes for Security', 'Join this session to explore how Kubernetes can be used for Security. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Advanced', 'http://sessions.com/S036', 'Tech Lead', '2026-04-10', '09:00:00', '09:00:00', 'Room A', 200, 54, 'Security', 'Healthcare'),
('S037', 'Understanding Spanner for Integration', 'Join this session to explore how Spanner can be used for Integration. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Beginner', 'http://sessions.com/S037', 'Tech Lead', '2026-04-10', '14:00:00', '14:00:00', 'Room C', 200, 89, 'Databases', 'Technology'),
('S038', 'Deep Dive into Kubernetes for Automation', 'Join this session to explore how Kubernetes can be used for Automation. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Beginner', 'http://sessions.com/S038', 'Product Manager', '2026-04-11', '09:00:00', '09:00:00', 'Room C', 50, 47, 'AI & Machine Learning', 'Healthcare'),
('S039', 'Optimizing BigQuery for Reliability', 'Join this session to explore how BigQuery can be used for Reliability. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Beginner', 'http://sessions.com/S039', 'Director of Engineering', '2026-04-10', '14:00:00', '14:00:00', 'Auditorium', 200, 38, 'Databases', 'Retail'),
('S040', 'Deep Dive into Spanner for Cost Efficiency', 'Join this session to explore how Spanner can be used for Cost Efficiency. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Advanced', 'http://sessions.com/S040', 'Software Engineer', '2026-04-09', '14:00:00', '14:00:00', 'Auditorium', 50, 2, 'Databases', 'Healthcare'),
('S041', 'Exploring Gemini for Cost Efficiency', 'Join this session to explore how Gemini can be used for Cost Efficiency. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Intermediate', 'http://sessions.com/S041', 'Product Manager', '2026-04-10', '15:00:00', '15:00:00', 'Room A', 100, 73, 'AI & Machine Learning', 'Healthcare'),
('S042', 'Mastering ScaNN for Performance', 'Join this session to explore how ScaNN can be used for Performance. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Beginner', 'http://sessions.com/S042', 'Tech Lead', '2026-04-09', '11:00:00', '11:00:00', 'Auditorium', 100, 50, 'AI & Machine Learning', 'Manufacturing'),
('S043', 'Mastering ScaNN for Analytics', 'Join this session to explore how ScaNN can be used for Analytics. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Advanced', 'http://sessions.com/S043', 'Data Scientist', '2026-04-10', '09:00:00', '09:00:00', 'Room B', 200, 111, 'AI & Machine Learning', 'Technology'),
('S044', 'Securing Gemini for Integration', 'Join this session to explore how Gemini can be used for Integration. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Advanced', 'http://sessions.com/S044', 'Cloud Architect', '2026-04-09', '14:00:00', '14:00:00', 'Auditorium', 500, 281, 'AI & Machine Learning', 'Healthcare'),
('S045', 'Architecting Cloud SQL for Integration', 'Join this session to explore how Cloud SQL can be used for Integration. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Advanced', 'http://sessions.com/S045', 'Product Manager', '2026-04-11', '11:00:00', '11:00:00', 'Room C', 50, 6, 'AI & Machine Learning', 'Retail'),
('S046', 'Securing Kubernetes for Scale', 'Join this session to explore how Kubernetes can be used for Scale. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Beginner', 'http://sessions.com/S046', 'Security Engineer', '2026-04-11', '14:00:00', '14:00:00', 'Room B', 100, 80, 'AI & Machine Learning', 'Manufacturing'),
('S047', 'Mastering PostgreSQL for Integration', 'Join this session to explore how PostgreSQL can be used for Integration. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Advanced', 'http://sessions.com/S047', 'Tech Lead', '2026-04-10', '14:00:00', '14:00:00', 'Auditorium', 200, 134, 'Databases', 'Manufacturing'),
('S048', 'Deep Dive into Kubernetes for Cost Efficiency', 'Join this session to explore how Kubernetes can be used for Cost Efficiency. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Intermediate', 'http://sessions.com/S048', 'Data Scientist', '2026-04-11', '09:00:00', '09:00:00', 'Room C', 500, 102, 'AI & Machine Learning', 'Retail'),
('S049', 'Deep Dive into Cloud SQL for Scale', 'Join this session to explore how Cloud SQL can be used for Scale. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Beginner', 'http://sessions.com/S049', 'Security Engineer', '2026-04-09', '14:00:00', '14:00:00', 'Auditorium', 200, 127, 'AI & Machine Learning', 'Healthcare'),
('S050', 'Scaling Cloud SQL for Reliability', 'Join this session to explore how Cloud SQL can be used for Reliability. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Intermediate', 'http://sessions.com/S050', 'Software Engineer', '2026-04-10', '15:00:00', '15:00:00', 'Room A', 100, 40, 'Cloud Architecture', 'Finance'),
('S051', 'Building Vertex AI for Security', 'Join this session to explore how Vertex AI can be used for Security. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Beginner', 'http://sessions.com/S051', 'Director of Engineering', '2026-04-09', '15:00:00', '15:00:00', 'Room C', 500, 138, 'AI & Machine Learning', 'Retail'),
('S052', 'Exploring Vertex AI for Modernization', 'Join this session to explore how Vertex AI can be used for Modernization. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Intermediate', 'http://sessions.com/S052', 'DevOps Engineer', '2026-04-09', '09:00:00', '09:00:00', 'Room C', 200, 27, 'AI & Machine Learning', 'Finance'),
('S053', 'Optimizing Generative AI for Automation', 'Join this session to explore how Generative AI can be used for Automation. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Beginner', 'http://sessions.com/S053', 'Director of Engineering', '2026-04-10', '11:00:00', '11:00:00', 'Room C', 500, 65, 'Databases', 'Healthcare'),
('S054', 'Architecting PostgreSQL for Performance', 'Join this session to explore how PostgreSQL can be used for Performance. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Beginner', 'http://sessions.com/S054', 'Data Scientist', '2026-04-09', '11:00:00', '11:00:00', 'Auditorium', 200, 103, 'Databases', 'Healthcare'),
('S055', 'Mastering Generative AI for Automation', 'Join this session to explore how Generative AI can be used for Automation. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Intermediate', 'http://sessions.com/S055', 'Data Scientist', '2026-04-11', '11:00:00', '11:00:00', 'Room C', 50, 31, 'AI & Machine Learning', 'Technology'),
('S056', 'Exploring ScaNN for Reliability', 'Join this session to explore how ScaNN can be used for Reliability. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Intermediate', 'http://sessions.com/S056', 'Security Engineer', '2026-04-11', '15:00:00', '15:00:00', 'Room A', 500, 351, 'AI & Machine Learning', 'Healthcare'),
('S057', 'Deep Dive into BigQuery for Performance', 'Join this session to explore how BigQuery can be used for Performance. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Intermediate', 'http://sessions.com/S057', 'DevOps Engineer', '2026-04-11', '11:00:00', '11:00:00', 'Room B', 200, 200, 'Databases', 'Finance'),
('S058', 'Scaling Generative AI for Reliability', 'Join this session to explore how Generative AI can be used for Reliability. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Beginner', 'http://sessions.com/S058', 'Cloud Architect', '2026-04-10', '11:00:00', '11:00:00', 'Room C', 100, 61, 'Databases', 'Finance'),
('S059', 'Securing Vertex AI for High Availability', 'Join this session to explore how Vertex AI can be used for High Availability. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Beginner', 'http://sessions.com/S059', 'Data Scientist', '2026-04-11', '16:00:00', '16:00:00', 'Room B', 500, 224, 'AI & Machine Learning', 'Manufacturing'),
('S060', 'Architecting AlloyDB for Integration', 'Join this session to explore how AlloyDB can be used for Integration. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Beginner', 'http://sessions.com/S060', 'Tech Lead', '2026-04-09', '14:00:00', '14:00:00', 'Room A', 500, 223, 'Databases', 'Technology'),
('S061', 'Understanding Spanner for High Availability', 'Join this session to explore how Spanner can be used for High Availability. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Advanced', 'http://sessions.com/S061', 'Tech Lead', '2026-04-09', '16:00:00', '16:00:00', 'Room C', 100, 52, 'Databases', 'Manufacturing'),
('S062', 'Scaling Kubernetes for Cost Efficiency', 'Join this session to explore how Kubernetes can be used for Cost Efficiency. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Advanced', 'http://sessions.com/S062', 'Product Manager', '2026-04-10', '16:00:00', '16:00:00', 'Room B', 100, 0, 'Cloud Architecture', 'Retail'),
('S063', 'Architecting Kubernetes for High Availability', 'Join this session to explore how Kubernetes can be used for High Availability. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Beginner', 'http://sessions.com/S063', 'Security Engineer', '2026-04-09', '10:00:00', '10:00:00', 'Auditorium', 200, 0, 'Security', 'Finance'),
('S064', 'Mastering Gemini for Integration', 'Join this session to explore how Gemini can be used for Integration. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Advanced', 'http://sessions.com/S064', 'Security Engineer', '2026-04-10', '15:00:00', '15:00:00', 'Room B', 100, 8, 'AI & Machine Learning', 'Technology'),
('S065', 'Optimizing Generative AI for Security', 'Join this session to explore how Generative AI can be used for Security. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Beginner', 'http://sessions.com/S065', 'Tech Lead', '2026-04-09', '15:00:00', '15:00:00', 'Room C', 500, 230, 'AI & Machine Learning', 'Retail'),
('S066', 'Optimizing BigQuery for Scale', 'Join this session to explore how BigQuery can be used for Scale. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Intermediate', 'http://sessions.com/S066', 'Tech Lead', '2026-04-11', '10:00:00', '10:00:00', 'Room C', 500, 186, 'Databases', 'Healthcare'),
('S067', 'Scaling PostgreSQL for Automation', 'Join this session to explore how PostgreSQL can be used for Automation. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Beginner', 'http://sessions.com/S067', 'Product Manager', '2026-04-10', '11:00:00', '11:00:00', 'Auditorium', 100, 17, 'Databases', 'Retail'),
('S068', 'Exploring AlloyDB for Automation', 'Join this session to explore how AlloyDB can be used for Automation. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Beginner', 'http://sessions.com/S068', 'Director of Engineering', '2026-04-11', '16:00:00', '16:00:00', 'Room B', 100, 77, 'Databases', 'Retail'),
('S069', 'Securing BigQuery for Cost Efficiency', 'Join this session to explore how BigQuery can be used for Cost Efficiency. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Advanced', 'http://sessions.com/S069', 'Cloud Architect', '2026-04-09', '14:00:00', '14:00:00', 'Room A', 500, 437, 'Databases', 'Manufacturing'),
('S070', 'Deep Dive into Kubernetes for Integration', 'Join this session to explore how Kubernetes can be used for Integration. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Intermediate', 'http://sessions.com/S070', 'Cloud Architect', '2026-04-11', '11:00:00', '11:00:00', 'Room A', 50, 46, 'AI & Machine Learning', 'Technology'),
('S071', 'Architecting ScaNN for Cost Efficiency', 'Join this session to explore how ScaNN can be used for Cost Efficiency. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Intermediate', 'http://sessions.com/S071', 'Cloud Architect', '2026-04-11', '14:00:00', '14:00:00', 'Auditorium', 100, 97, 'AI & Machine Learning', 'Finance'),
('S072', 'Scaling ScaNN for Analytics', 'Join this session to explore how ScaNN can be used for Analytics. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Beginner', 'http://sessions.com/S072', 'Cloud Architect', '2026-04-09', '11:00:00', '11:00:00', 'Room C', 100, 96, 'AI & Machine Learning', 'Manufacturing'),
('S073', 'Securing Cloud SQL for Modernization', 'Join this session to explore how Cloud SQL can be used for Modernization. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Advanced', 'http://sessions.com/S073', 'Tech Lead', '2026-04-10', '16:00:00', '16:00:00', 'Room C', 200, 195, 'Security', 'Technology'),
('S074', 'Deploying ScaNN for Scale', 'Join this session to explore how ScaNN can be used for Scale. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Beginner', 'http://sessions.com/S074', 'Data Scientist', '2026-04-10', '10:00:00', '10:00:00', 'Room A', 500, 215, 'AI & Machine Learning', 'Technology'),
('S075', 'Architecting BigQuery for Automation', 'Join this session to explore how BigQuery can be used for Automation. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Advanced', 'http://sessions.com/S075', 'Product Manager', '2026-04-09', '09:00:00', '09:00:00', 'Room A', 200, 110, 'Databases', 'Healthcare'),
('S076', 'Understanding Vertex AI for Scale', 'Join this session to explore how Vertex AI can be used for Scale. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Advanced', 'http://sessions.com/S076', 'Software Engineer', '2026-04-11', '15:00:00', '15:00:00', 'Room B', 200, 15, 'AI & Machine Learning', 'Finance'),
('S077', 'Architecting PostgreSQL for Reliability', 'Join this session to explore how PostgreSQL can be used for Reliability. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Advanced', 'http://sessions.com/S077', 'Director of Engineering', '2026-04-09', '11:00:00', '11:00:00', 'Room C', 200, 133, 'Databases', 'Finance'),
('S078', 'Deploying Generative AI for Analytics', 'Join this session to explore how Generative AI can be used for Analytics. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Intermediate', 'http://sessions.com/S078', 'Product Manager', '2026-04-11', '16:00:00', '16:00:00', 'Room A', 200, 190, 'AI & Machine Learning', 'Manufacturing'),
('S079', 'Deploying ScaNN for Analytics', 'Join this session to explore how ScaNN can be used for Analytics. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Advanced', 'http://sessions.com/S079', 'Cloud Architect', '2026-04-11', '16:00:00', '16:00:00', 'Room B', 200, 95, 'AI & Machine Learning', 'Technology'),
('S080', 'Securing Spanner for Security', 'Join this session to explore how Spanner can be used for Security. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Intermediate', 'http://sessions.com/S080', 'Tech Lead', '2026-04-11', '14:00:00', '14:00:00', 'Room A', 500, 310, 'Databases', 'Healthcare'),
('S081', 'Optimizing Cloud SQL for Performance', 'Join this session to explore how Cloud SQL can be used for Performance. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Beginner', 'http://sessions.com/S081', 'Security Engineer', '2026-04-11', '11:00:00', '11:00:00', 'Room B', 100, 76, 'Databases', 'Finance'),
('S082', 'Exploring Spanner for Cost Efficiency', 'Join this session to explore how Spanner can be used for Cost Efficiency. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Advanced', 'http://sessions.com/S082', 'Tech Lead', '2026-04-11', '15:00:00', '15:00:00', 'Room C', 50, 1, 'Databases', 'Manufacturing'),
('S083', 'Understanding Kubernetes for Performance', 'Join this session to explore how Kubernetes can be used for Performance. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Beginner', 'http://sessions.com/S083', 'Product Manager', '2026-04-11', '14:00:00', '14:00:00', 'Auditorium', 100, 49, 'Security', 'Retail'),
('S084', 'Exploring Cloud SQL for Cost Efficiency', 'Join this session to explore how Cloud SQL can be used for Cost Efficiency. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Intermediate', 'http://sessions.com/S084', 'Tech Lead', '2026-04-09', '16:00:00', '16:00:00', 'Room C', 500, 91, 'Cloud Architecture', 'Healthcare'),
('S085', 'Scaling Kubernetes for Automation', 'Join this session to explore how Kubernetes can be used for Automation. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Intermediate', 'http://sessions.com/S085', 'Director of Engineering', '2026-04-10', '10:00:00', '10:00:00', 'Room B', 500, 204, 'Databases', 'Finance'),
('S086', 'Deep Dive into BigQuery for Cost Efficiency', 'Join this session to explore how BigQuery can be used for Cost Efficiency. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Beginner', 'http://sessions.com/S086', 'Product Manager', '2026-04-09', '16:00:00', '16:00:00', 'Room B', 100, 89, 'Databases', 'Finance'),
('S087', 'Deep Dive into Vertex AI for Automation', 'Join this session to explore how Vertex AI can be used for Automation. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Beginner', 'http://sessions.com/S087', 'Data Scientist', '2026-04-10', '14:00:00', '14:00:00', 'Auditorium', 100, 74, 'AI & Machine Learning', 'Retail'),
('S088', 'Mastering AlloyDB for Modernization', 'Join this session to explore how AlloyDB can be used for Modernization. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Beginner', 'http://sessions.com/S088', 'Security Engineer', '2026-04-09', '16:00:00', '16:00:00', 'Room C', 100, 39, 'Databases', 'Healthcare'),
('S089', 'Exploring AlloyDB for High Availability', 'Join this session to explore how AlloyDB can be used for High Availability. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Advanced', 'http://sessions.com/S089', 'Data Scientist', '2026-04-10', '15:00:00', '15:00:00', 'Room A', 100, 94, 'Databases', 'Healthcare'),
('S090', 'Exploring Vertex AI for Security', 'Join this session to explore how Vertex AI can be used for Security. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Intermediate', 'http://sessions.com/S090', 'Security Engineer', '2026-04-11', '10:00:00', '10:00:00', 'Room B', 50, 27, 'AI & Machine Learning', 'Retail'),
('S091', 'Mastering ScaNN for Cost Efficiency', 'Join this session to explore how ScaNN can be used for Cost Efficiency. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Advanced', 'http://sessions.com/S091', 'DevOps Engineer', '2026-04-09', '14:00:00', '14:00:00', 'Auditorium', 100, 21, 'AI & Machine Learning', 'Technology'),
('S092', 'Mastering BigQuery for Scale', 'Join this session to explore how BigQuery can be used for Scale. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Advanced', 'http://sessions.com/S092', 'Cloud Architect', '2026-04-09', '16:00:00', '16:00:00', 'Room C', 200, 67, 'Databases', 'Manufacturing'),
('S093', 'Exploring AlloyDB for Performance', 'Join this session to explore how AlloyDB can be used for Performance. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Beginner', 'http://sessions.com/S093', 'Security Engineer', '2026-04-09', '10:00:00', '10:00:00', 'Room B', 200, 171, 'Databases', 'Finance'),
('S094', 'Deploying Cloud SQL for Modernization', 'Join this session to explore how Cloud SQL can be used for Modernization. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Advanced', 'http://sessions.com/S094', 'Product Manager', '2026-04-09', '14:00:00', '14:00:00', 'Room B', 100, 71, 'DevOps', 'Healthcare'),
('S095', 'Building Spanner for Analytics', 'Join this session to explore how Spanner can be used for Analytics. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Beginner', 'http://sessions.com/S095', 'Product Manager', '2026-04-10', '15:00:00', '15:00:00', 'Room B', 500, 334, 'Databases', 'Manufacturing'),
('S096', 'Deep Dive into Vertex AI for Analytics', 'Join this session to explore how Vertex AI can be used for Analytics. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Intermediate', 'http://sessions.com/S096', 'DevOps Engineer', '2026-04-11', '14:00:00', '14:00:00', 'Room C', 100, 27, 'AI & Machine Learning', 'Healthcare'),
('S097', 'Deploying PostgreSQL for Analytics', 'Join this session to explore how PostgreSQL can be used for Analytics. We will cover best practices, real-world use cases, and advanced configuration options.', 'Breakouts', 'Beginner', 'http://sessions.com/S097', 'Cloud Architect', '2026-04-09', '11:00:00', '11:00:00', 'Room C', 50, 36, 'Databases', 'Healthcare'),
('S098', 'Architecting Kubernetes for Reliability', 'Join this session to explore how Kubernetes can be used for Reliability. We will cover best practices, real-world use cases, and advanced configuration options.', 'Lightning Talks', 'Beginner', 'http://sessions.com/S098', 'Cloud Architect', '2026-04-10', '11:00:00', '11:00:00', 'Room A', 50, 29, 'AI & Machine Learning', 'Finance'),
('S099', 'Scaling Cloud SQL for Analytics', 'Join this session to explore how Cloud SQL can be used for Analytics. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Beginner', 'http://sessions.com/S099', 'DevOps Engineer', '2026-04-09', '09:00:00', '09:00:00', 'Auditorium', 50, 21, 'Security', 'Finance'),
('S100', 'Deploying PostgreSQL for Analytics', 'Join this session to explore how PostgreSQL can be used for Analytics. We will cover best practices, real-world use cases, and advanced configuration options.', 'Keynotes', 'Advanced', 'http://sessions.com/S100', 'DevOps Engineer', '2026-04-11', '09:00:00', '09:00:00', 'Room B', 500, 141, 'Databases', 'Technology') ON CONFLICT (session_id) DO NOTHING;
3.5 Chỉ định diễn giả cho các phiên
-- Insert Session-Speaker Mappings
INSERT INTO public.session_speaker_mapping (session_id, speaker_id) VALUES
('S001', 6),
('S001', 19),
('S002', 6),
('S002', 11),
('S003', 14),
('S003', 10),
('S004', 5),
('S004', 8),
('S005', 12),
('S005', 9),
('S006', 14),
('S007', 14),
('S007', 3),
('S008', 2),
('S008', 4),
('S009', 9),
('S009', 13),
('S010', 2),
('S010', 3),
('S011', 12),
('S012', 13),
('S013', 11),
('S014', 8),
('S015', 16),
('S016', 4),
('S016', 18),
('S017', 12),
('S018', 10),
('S019', 15),
('S020', 20),
('S020', 7),
('S021', 2),
('S021', 11),
('S022', 15),
('S022', 7),
('S023', 4),
('S023', 19),
('S024', 11),
('S025', 11),
('S025', 10),
('S026', 11),
('S027', 20),
('S028', 20),
('S028', 3),
('S029', 11),
('S029', 20),
('S030', 19),
('S030', 6),
('S031', 20),
('S031', 14),
('S032', 3),
('S033', 4),
('S033', 8),
('S034', 14),
('S035', 12),
('S035', 4),
('S036', 18),
('S037', 6),
('S038', 9),
('S038', 7),
('S039', 7),
('S040', 17),
('S041', 17),
('S042', 16),
('S042', 2),
('S043', 10),
('S043', 13),
('S044', 7),
('S045', 10),
('S046', 1),
('S046', 20),
('S047', 17),
('S048', 9),
('S048', 6),
('S049', 4),
('S049', 3),
('S050', 8),
('S050', 16),
('S051', 18),
('S051', 10),
('S052', 4),
('S053', 5),
('S053', 13),
('S054', 17),
('S055', 1),
('S056', 1),
('S056', 15),
('S057', 7),
('S058', 15),
('S059', 15),
('S059', 8),
('S060', 20),
('S060', 10),
('S061', 16),
('S062', 18),
('S062', 11),
('S063', 10),
('S064', 6),
('S065', 10),
('S066', 8),
('S066', 9),
('S067', 16),
('S067', 14),
('S068', 13),
('S068', 11),
('S069', 16),
('S070', 8),
('S071', 3),
('S072', 10),
('S072', 1),
('S073', 10),
('S073', 8),
('S074', 20),
('S074', 14),
('S075', 5),
('S076', 1),
('S076', 11),
('S077', 3),
('S078', 20),
('S078', 12),
('S079', 17),
('S079', 9),
('S080', 10),
('S081', 2),
('S082', 15),
('S082', 11),
('S083', 7),
('S083', 1),
('S084', 8),
('S085', 8),
('S085', 18),
('S086', 5),
('S087', 5),
('S088', 19),
('S088', 18),
('S089', 18),
('S090', 8),
('S091', 4),
('S092', 14),
('S093', 20),
('S093', 17),
('S094', 16),
('S094', 9),
('S095', 11),
('S095', 4),
('S096', 14),
('S096', 11),
('S097', 13),
('S097', 19),
('S098', 3),
('S099', 11),
('S099', 18),
('S100', 18),
('S100', 13) ON CONFLICT DO NOTHING;
3.6 Đính kèm chủ đề vào phiên
-- Insert Session-Topic Mappings
INSERT INTO public.session_topic_mapping (session_id, topic) VALUES
('S001', 'Security'),
('S002', 'AI & Machine Learning'),
('S003', 'Cloud Architecture'),
('S003', 'AI & Machine Learning'),
('S004', 'Databases'),
('S004', 'DevOps'),
('S005', 'DevOps'),
('S005', 'Cloud Architecture'),
('S006', 'Security'),
('S006', 'AI & Machine Learning'),
('S007', 'Cloud Architecture'),
('S007', 'Databases'),
('S008', 'AI & Machine Learning'),
('S008', 'Databases'),
('S009', 'Security'),
('S009', 'DevOps'),
('S010', 'AI & Machine Learning'),
('S010', 'Cloud Architecture'),
('S011', 'Security'),
('S012', 'Databases'),
('S013', 'Cloud Architecture'),
('S014', 'Databases'),
('S015', 'DevOps'),
('S015', 'Security'),
('S016', 'AI & Machine Learning'),
('S016', 'Databases'),
('S017', 'Cloud Architecture'),
('S018', 'AI & Machine Learning'),
('S019', 'AI & Machine Learning'),
('S020', 'Security'),
('S021', 'Security'),
('S021', 'Databases'),
('S022', 'Security'),
('S022', 'Databases'),
('S023', 'DevOps'),
('S023', 'AI & Machine Learning'),
('S024', 'AI & Machine Learning'),
('S025', 'Databases'),
('S026', 'DevOps'),
('S027', 'DevOps'),
('S027', 'Cloud Architecture'),
('S028', 'DevOps'),
('S029', 'Databases'),
('S029', 'Security'),
('S030', 'DevOps'),
('S030', 'Security'),
('S031', 'Databases'),
('S032', 'Databases'),
('S033', 'Databases'),
('S034', 'AI & Machine Learning'),
('S035', 'Security'),
('S035', 'AI & Machine Learning'),
('S036', 'AI & Machine Learning'),
('S036', 'Databases'),
('S037', 'DevOps'),
('S037', 'Databases'),
('S038', 'Cloud Architecture'),
('S038', 'Security'),
('S039', 'Security'),
('S040', 'Security'),
('S040', 'AI & Machine Learning'),
('S041', 'AI & Machine Learning'),
('S042', 'Databases'),
('S043', 'AI & Machine Learning'),
('S043', 'Databases'),
('S044', 'Databases'),
('S044', 'DevOps'),
('S045', 'DevOps'),
('S045', 'Cloud Architecture'),
('S046', 'Cloud Architecture'),
('S046', 'Security'),
('S047', 'Cloud Architecture'),
('S047', 'Security'),
('S048', 'Databases'),
('S049', 'AI & Machine Learning'),
('S049', 'Databases'),
('S050', 'Cloud Architecture'),
('S050', 'AI & Machine Learning'),
('S051', 'DevOps'),
('S051', 'Databases'),
('S052', 'Databases'),
('S053', 'DevOps'),
('S053', 'Databases'),
('S054', 'Security'),
('S054', 'DevOps'),
('S055', 'AI & Machine Learning'),
('S056', 'Security'),
('S056', 'DevOps'),
('S057', 'AI & Machine Learning'),
('S058', 'Security'),
('S058', 'AI & Machine Learning'),
('S059', 'Security'),
('S060', 'AI & Machine Learning'),
('S060', 'DevOps'),
('S061', 'Security'),
('S061', 'AI & Machine Learning'),
('S062', 'DevOps'),
('S063', 'Security'),
('S063', 'DevOps'),
('S064', 'Databases'),
('S064', 'AI & Machine Learning'),
('S065', 'DevOps'),
('S066', 'AI & Machine Learning'),
('S066', 'Cloud Architecture'),
('S067', 'AI & Machine Learning'),
('S068', 'Security'),
('S069', 'Cloud Architecture'),
('S069', 'DevOps'),
('S070', 'AI & Machine Learning'),
('S071', 'AI & Machine Learning'),
('S071', 'DevOps'),
('S072', 'DevOps'),
('S072', 'Security'),
('S073', 'Security'),
('S074', 'AI & Machine Learning'),
('S074', 'Databases'),
('S075', 'AI & Machine Learning'),
('S076', 'DevOps'),
('S077', 'DevOps'),
('S077', 'AI & Machine Learning'),
('S078', 'Databases'),
('S079', 'Databases'),
('S080', 'AI & Machine Learning'),
('S080', 'Databases'),
('S081', 'Databases'),
('S082', 'Databases'),
('S083', 'Security'),
('S084', 'Security'),
('S084', 'AI & Machine Learning'),
('S085', 'AI & Machine Learning'),
('S085', 'Databases'),
('S086', 'DevOps'),
('S087', 'Databases'),
('S088', 'Security'),
('S088', 'Databases'),
('S089', 'Databases'),
('S090', 'DevOps'),
('S091', 'Databases'),
('S092', 'Databases'),
('S093', 'Security'),
('S093', 'AI & Machine Learning'),
('S094', 'Cloud Architecture'),
('S095', 'Cloud Architecture'),
('S095', 'AI & Machine Learning'),
('S096', 'AI & Machine Learning'),
('S097', 'Security'),
('S097', 'AI & Machine Learning'),
('S098', 'Databases'),
('S098', 'Security'),
('S099', 'Cloud Architecture'),
('S100', 'DevOps'),
('S100', 'Cloud Architecture') ON CONFLICT DO NOTHING;;
3.7 Chỉ định người tham dự vào các phiên
-- Insert Attendee-Session Mappings
INSERT INTO public.attendees_sessions (username, session_id) VALUES
('user_1', 'S100'),
('user_1', 'S008'),
('user_1', 'S060'),
('user_1', 'S090'),
('user_1', 'S057'),
('user_2', 'S086'),
('user_2', 'S033'),
('user_2', 'S006'),
('user_2', 'S043'),
('user_2', 'S050'),
('user_3', 'S066'),
('user_3', 'S099'),
('user_4', 'S004'),
('user_4', 'S043'),
('user_4', 'S092'),
('user_4', 'S033'),
('user_4', 'S074'),
('user_5', 'S014'),
('user_5', 'S088'),
('user_5', 'S093'),
('user_6', 'S075'),
('user_6', 'S033'),
('user_7', 'S014'),
('user_7', 'S021'),
('user_7', 'S047'),
('user_8', 'S051'),
('user_8', 'S081'),
('user_9', 'S048'),
('user_9', 'S100'),
('user_10', 'S037'),
('user_10', 'S059'),
('user_10', 'S083'),
('user_11', 'S007'),
('user_11', 'S099'),
('user_11', 'S054'),
('user_12', 'S006'),
('user_12', 'S046'),
('user_12', 'S077'),
('user_12', 'S032'),
('user_13', 'S020'),
('user_13', 'S029'),
('user_13', 'S054'),
('user_14', 'S052'),
('user_14', 'S070'),
('user_14', 'S028'),
('user_15', 'S054'),
('user_15', 'S050'),
('user_15', 'S025'),
('user_15', 'S066'),
('user_15', 'S081'),
('user_16', 'S099'),
('user_16', 'S073'),
('user_16', 'S027'),
('user_16', 'S058'),
('user_17', 'S092'),
('user_17', 'S089'),
('user_17', 'S076'),
('user_17', 'S062'),
('user_18', 'S083'),
('user_18', 'S094'),
('user_18', 'S097'),
('user_18', 'S031'),
('user_18', 'S040'),
('user_19', 'S078'),
('user_19', 'S072'),
('user_19', 'S049'),
('user_19', 'S017'),
('user_19', 'S084'),
('user_20', 'S023'),
('user_20', 'S003'),
('user_20', 'S016'),
('user_20', 'S068'),
('user_21', 'S071'),
('user_21', 'S058'),
('user_21', 'S043'),
('user_21', 'S079'),
('user_21', 'S067'),
('user_22', 'S076'),
('user_22', 'S038'),
('user_22', 'S049'),
('user_22', 'S033'),
('user_22', 'S070'),
('user_23', 'S032'),
('user_23', 'S099'),
('user_24', 'S022'),
('user_24', 'S065'),
('user_24', 'S060'),
('user_24', 'S084'),
('user_25', 'S077'),
('user_25', 'S080'),
('user_25', 'S097'),
('user_25', 'S010'),
('user_26', 'S063'),
('user_26', 'S052'),
('user_26', 'S086'),
('user_27', 'S054'),
('user_27', 'S094'),
('user_27', 'S018'),
('user_27', 'S061'),
('user_27', 'S052'),
('user_28', 'S064'),
('user_28', 'S070'),
('user_28', 'S050'),
('user_29', 'S009'),
('user_29', 'S012'),
('user_30', 'S058'),
('user_30', 'S056'),
('user_30', 'S072'),
('user_30', 'S093'),
('user_30', 'S045'),
('user_31', 'S001'),
('user_31', 'S094'),
('user_31', 'S065'),
('user_31', 'S031'),
('user_32', 'S048'),
('user_32', 'S011'),
('user_32', 'S065'),
('user_33', 'S021'),
('user_33', 'S081'),
('user_33', 'S063'),
('user_34', 'S068'),
('user_34', 'S026'),
('user_35', 'S044'),
('user_35', 'S054'),
('user_36', 'S023'),
('user_36', 'S051'),
('user_36', 'S100'),
('user_37', 'S047'),
('user_37', 'S053'),
('user_37', 'S057'),
('user_37', 'S048'),
('user_37', 'S080'),
('user_38', 'S003'),
('user_38', 'S038'),
('user_38', 'S046'),
('user_38', 'S005'),
('user_38', 'S076'),
('user_39', 'S046'),
('user_39', 'S020'),
('user_39', 'S043'),
('user_39', 'S002'),
('user_39', 'S100'),
('user_40', 'S019'),
('user_40', 'S098'),
('user_40', 'S053'),
('user_40', 'S007'),
('user_41', 'S100'),
('user_41', 'S032'),
('user_41', 'S048'),
('user_41', 'S064'),
('user_42', 'S086'),
('user_42', 'S030'),
('user_42', 'S049'),
('user_43', 'S033'),
('user_43', 'S008'),
('user_43', 'S049'),
('user_43', 'S093'),
('user_44', 'S078'),
('user_44', 'S071'),
('user_44', 'S067'),
('user_44', 'S012'),
('user_45', 'S043'),
('user_45', 'S056'),
('user_45', 'S079'),
('user_45', 'S062'),
('user_45', 'S039'),
('user_46', 'S054'),
('user_46', 'S031'),
('user_46', 'S018'),
('user_47', 'S035'),
('user_47', 'S100'),
('user_47', 'S083'),
('user_47', 'S080'),
('user_47', 'S037'),
('user_48', 'S097'),
('user_48', 'S026'),
('user_48', 'S065'),
('user_48', 'S030'),
('user_48', 'S074'),
('user_49', 'S022'),
('user_49', 'S089'),
('user_49', 'S038'),
('user_49', 'S047'),
('user_49', 'S073'),
('user_50', 'S074'),
('user_50', 'S033'),
('user_50', 'S069'),
('user_50', 'S036') ON CONFLICT DO NOTHING;
Bạn sẽ thấy kết quả cho biết quá trình thực thi đã thành công. Xác minh rằng các bảng đã được điền sẵn. Ví dụ: xác minh rằng bạn có 100 phiên trong bảng phiên:
SELECT count(*) from public.session;
7. Bật Công cụ truy vấn AI
Trước khi sử dụng các hàm AI, bạn phải bật công cụ truy vấn AI trong cơ sở dữ liệu.
Chạy SQL sau đây trong AlloyDB Studio (bối cảnh conference_db):
CREATE EXTENSION IF NOT EXISTS google_ml_integration CASCADE;
ALTER DATABASE conference_db SET google_ml_integration.enable_ai_query_engine = 'on';
Xác minh rằng tiện ích đã được bật:
SELECT extversion FROM pg_extension WHERE extname = 'google_ml_integration';
Đầu ra dự kiến phải cho thấy 1.5.9 trở lên.
8. Sử dụng các hàm AI (toán tử)
Bây giờ, hãy sử dụng tính năng lọc và tính điểm ngữ nghĩa dựa trên AI bằng các hàm ai.if và ai.rank.
Lọc ngữ nghĩa bằng ai.if
Tính năng so khớp văn bản tiêu chuẩn có thể bỏ lỡ các phiên nếu không có từ khoá chính xác. Hãy tìm các phiên về "AI tạo sinh" bằng cách sử dụng ai.if.
Chạy SQL sau trong AlloyDB Studio:
SELECT session_name, full_description
FROM public.session
WHERE
ai.if(
prompt => 'Is this session description about Generative AI, LLMs or AI agents? ' || full_description
);
Bạn sẽ thấy các phiên có liên quan trong kết quả, ngay cả khi các phiên đó sử dụng thuật ngữ khác.
Tính điểm ngữ nghĩa bằng ai.rank
Hãy đánh giá các phiên dựa trên mức độ phù hợp với người mới bắt đầu. Chúng ta có thể sử dụng ai.rank để tính điểm ngữ nghĩa.
Chạy SQL sau:
SELECT session_name, full_description,
ai.rank(
prompt => 'On a scale of 0 to 1, how suitable is this session for a beginner? 1 being very suitable, 0 being advanced. Session: ' || full_description
) as beginner_friendly_score
FROM public.session
ORDER BY beginner_friendly_score DESC;
Điều này hữu ích khi tạo đề xuất dành riêng cho từng người tham dự hội nghị dựa trên hồ sơ của họ.
9. Triển khai tính năng Tìm kiếm kết hợp
Tìm kiếm kết hợp là sự kết hợp giữa độ chính xác của tìm kiếm từ khoá (từ vựng) với khả năng hiểu ngữ cảnh của tìm kiếm vectơ (ngữ nghĩa). Chúng ta sẽ tạo chỉ mục cho cả hai và sử dụng phương pháp Kết hợp thứ hạng tương hỗ (RRF) để hợp nhất kết quả.
Bật tính năng quét
Đảm bảo bạn đã bật tiện ích scann và rum:
CREATE EXTENSION IF NOT EXISTS alloydb_scann;
CREATE EXTENSION IF NOT EXISTS rum;
Tạo chỉ mục
Vì giản đồ của chúng tôi sử dụng cột được tạo cho các mục nhúng (full_description_embedding), nên các mục này sẽ được tự động tính toán khi chèn. Chúng ta chỉ cần tạo các chỉ mục phù hợp để truy xuất nhanh.
Tạo một chỉ mục RUM (chỉ mục FTS) để tìm kiếm từ khoá toàn văn và một chỉ mục ScaNN để tìm kiếm nhanh sự tương đồng của vectơ.
Chạy SQL sau trong AlloyDB Studio:
-- Create RUM index for text search on session descriptions
CREATE INDEX session_text_idx ON public.session USING RUM (description_tsvector rum_tsvector_ops);
-- Create ScaNN index for vector search on session embeddings
CREATE INDEX session_vector_idx ON public.session
USING scann (full_description_embedding cosine)
WITH (num_leaves=10);
Chạy tính năng Tìm kiếm kết hợp bằng RRF
Bây giờ, chúng ta muốn tìm phiên trên fast similarity search, nhưng tập trung vào ScaNN của AlloyDB.
Chúng tôi sẽ sử dụng tính năng tìm kiếm ngữ nghĩa và tìm kiếm từ khoá, đồng thời hợp nhất kết quả bằng RRF.
Chạy SQL sau:
-- Enable preview features for the AI Query Engine if not already set
SET google_ml_integration.enable_preview_ai_functions = true;
SELECT s.session_id, s.session_name, s.full_description
FROM public.session s
JOIN ai.hybrid_search(
search_inputs => ARRAY[
'{
"data_type": "vector",
"table_name": "session",
"key_column": "session_id",
"vec_column": "full_description_embedding",
"distance_operator": "public.<=>",
"limit": 5,
"query_vector": "ai.embedding(''text-embedding-005'', ''fast similarity search'')::vector"
}'::JSONB,
'{
"data_type": "text",
"table_name": "session",
"key_column": "session_id",
"text_column": "description_tsvector",
"limit": 5,
"ranking_function": "<=>",
"query_text_input": "ScaNN"
}'::JSONB
]
) AS search_results
on s.session_id = search_results.id;
Bạn sẽ thấy kết quả tìm kiếm tương tự về các phiên có liên quan, trong đó hầu hết kết quả đều cho thấy các phiên liên quan đến ScaNN.
10. Làm việc với QueryData trong AlloyDB Studio
AI AlloyDB cho phép bạn sử dụng QueryData để tạo các câu lệnh SQL chính xác và có thể dự đoán từ dữ liệu đầu vào bằng ngôn ngữ tự nhiên. Trong phần này, bạn sẽ tìm hiểu cách tạo một ngữ cảnh QueryData (mẫu) và kiểm thử ngữ cảnh đó ngay trong AlloyDB Studio.
Tạo ngữ cảnh QueryData
Ngữ cảnh QueryData là một tệp JSON có các mẫu truy vấn và khía cạnh cung cấp dữ liệu và hướng dẫn cần thiết cho mô hình AI để sử dụng các truy vấn SQL hoặc phần truy vấn SQL chính xác.
Hãy xem một bối cảnh JSON mẫu được thiết kế cho giản đồ hội nghị của chúng ta. Xin lưu ý rằng chúng tôi đảm bảo tên bảng khớp với lược đồ của mình (ví dụ: public.session).
Sau đây là nội dung JSON mà chúng ta sẽ sử dụng – Lưu nội dung này vào một tệp .json cục bộ trên máy tính xách tay/máy tính của bạn :
{
"templates": [
{
"nlQuery": "Advanced sessions that are almost full",
"sql": "SELECT session_name, remaining_capacity, session_date, session_start_time FROM session WHERE learning_level = 'Advanced' AND remaining_capacity > 0 AND remaining_capacity < 5 ORDER BY remaining_capacity ASC",
"intent": "Advanced sessions that are almost full (remaining capacity less than 5)",
"manifest": "Advanced sessions that are almost full (remaining capacity less than 5)",
"parameterized": {
"parameterized_intent": "$1 sessions that are almost full (remaining capacity less than 5)",
"parameterized_sql": "SELECT session_name, remaining_capacity, session_date, session_start_time FROM public.session WHERE learning_level = $1 AND remaining_capacity > 0 AND remaining_capacity < 5 ORDER BY remaining_capacity ASC"
}
},
{
"nlQuery": "Find sessions about Gemini",
"sql": "SELECT name, format, session_date, description FROM ((SELECT s1.session_name AS name, s1.session_format AS format, s1.session_date AS session_date, s1.full_description AS description, (s1.full_description_embedding <=> public.embedding('text-embedding-005', 'Gemini')::public.vector) AS distance FROM public.session s1 ORDER BY distance LIMIT 10) UNION ALL (SELECT s2.session_name AS name, s2.session_format AS format, s2.session_date AS session_date, t.topic_desc AS description, (t.embedding <=> public.embedding('text-embedding-005', 'Gemini')::public.vector) AS distance FROM public.session s2 INNER JOIN public.session_topic_mapping stm ON s2.session_id = stm.session_id INNER JOIN public.session_topic t ON stm.topic = t.topic ORDER BY distance LIMIT 10)) AS combined_results ORDER BY distance LIMIT 10",
"intent": "Find sessions about Gemini",
"manifest": "Find sessions about a given topic",
"parameterized": {
"parameterized_intent": "Find sessions about $1",
"parameterized_sql": "SELECT name, format, session_date, description FROM ((SELECT s1.session_name AS name, s1.session_format AS format, s1.session_date AS session_date, s1.full_description AS description, (s1.full_description_embedding <=> public.embedding('text-embedding-005', '$1')::public.vector) AS distance FROM public.session s1 ORDER BY distance LIMIT 10) UNION ALL (SELECT s2.session_name AS name, s2.session_format AS format, s2.session_date AS session_date, t.topic_desc AS description, (t.embedding <=> public.embedding('text-embedding-005', '$1')::public.vector) AS distance FROM public.session s2 INNER JOIN public.session_topic_mapping stm ON s2.session_id = stm.session_id INNER JOIN public.session_topic t ON stm.topic = t.topic ORDER BY distance LIMIT 10)) AS combined_results ORDER BY distance LIMIT 10"
}
}
]
}
Tải bối cảnh QueryData trong AlloyDB Studio
Để sử dụng bối cảnh Dữ liệu truy vấn, chúng ta cần tải bối cảnh này lên cơ sở dữ liệu thông qua AlloyDB Studio.
- Mở AlloyDB Studio trong Google Cloud Console.
- Ở cuối bảng điều khiển bên trái, bạn sẽ thấy Bộ bối cảnh và dấu ba chấm.
- Nhấp vào biểu tượng đó rồi chọn Tạo bộ bối cảnh.
- Điền thông tin vào hộp thoại:
- Tên:
conference_context - Nội dung mô tả:
Conference Sessions QueryData Context - Tải tệp ngữ cảnh lên: Tải tệp JSON được tạo bằng nội dung ở trên lên.
- Tên:
- Lưu lại
Kiểm thử bối cảnh QueryData
Sau khi tải lên, bạn có thể kiểm thử trực tiếp trong AlloyDB Studio.
- Nhấp vào biểu tượng ba dấu chấm bên cạnh ngữ cảnh bạn vừa tạo rồi chọn Kiểm thử bộ ngữ cảnh (hoặc sử dụng nút Gemini trong trình chỉnh sửa truy vấn rồi chọn ngữ cảnh này).
- Trong câu lệnh tạo SQL của Gemini, hãy nhập một truy vấn bằng ngôn ngữ tự nhiên khớp với mẫu của chúng tôi:
Advanced sessions that are almost full - Tạo SQL và xác minh rằng SQL đó khớp với mẫu mà chúng tôi cung cấp.
- Hãy thử một truy vấn có tham số bằng cách thay đổi "Nâng cao" thành "Người mới bắt đầu" trong câu lệnh bằng ngôn ngữ tự nhiên và xem liệu truy vấn đó có thích ứng hay không!
11. Dọn dẹp
Xoá cụm AlloyDB
Để tránh các khoản phí phát sinh cho tài khoản Google Cloud của bạn, hãy xoá các tài nguyên đã tạo trong lớp học lập trình này.
Chạy các lệnh sau trong Cloud Shell để xoá cụm AlloyDB (thao tác này cũng sẽ xoá phiên bản):
export REGION=us-central1
export ADBCLUSTER=alloydb-next26-ai-demo-01
echo "=> Deleting AlloyDB Cluster (${ADBCLUSTER})..."
gcloud alloydb clusters delete $ADBCLUSTER --region=$REGION --force
Ngoài ra, nếu đã tạo một dự án dành riêng cho lớp học lập trình này, bạn có thể xoá toàn bộ dự án.
Xoá dải IP và vpc-peering
PROJECT_ID=$(gcloud config get-value project)
echo "=> Deleting Service Networking VPC Peering..."
gcloud compute networks peerings delete servicenetworking-googleapis-com \
--network=default \
--project=${PROJECT_ID} --quiet || true
echo "=> Deleting Allocated IP Range for Managed Services..."
gcloud compute addresses delete psa-range \
--global \
--project=${PROJECT_ID} --quiet || true
Xoá tệp trên thiết bị
Xoá tệp JSON cục bộ được tạo ở bước Work with QueryData in AlloyDB Studio.
12. Xin chúc mừng
Xin chúc mừng! Bạn đã khám phá thành công nhiều chức năng AI của AlloyDB bằng cách sử dụng một kịch bản hợp nhất về Phiên họp hội nghị.
Nội dung đã đề cập
- Cách bật và sử dụng các chức năng AI (
ai.if,ai.rank) để lọc và tính điểm theo ngữ nghĩa. - Cách triển khai Tìm kiếm kết hợp bằng cách sử dụng chỉ mục ScaNN (vectơ) và RUM (văn bản) với Reciprocal Rank Fusion (RRF).
- Cách sử dụng QueryData trong AlloyDB Studio để tạo SQL có thể dự đoán từ ngôn ngữ tự nhiên.
Các bước tiếp theo
- Khám phá tài liệu về AI AlloyDB.
- Tìm hiểu thêm về pgvector và ScaNN.