Download schema.sql from Veweew/stack-parquet: direct link, hf CLI and curl.
- Browser
- Download file 11.8 kB
-
https://huggingface.co/datasets/Veweew/stack-parquet/resolve/main/schema.sql
- Command line
-
hf download hf://datasets/Veweew/stack-parquet/schema.sql
-
curl -L -o schema.sql https://huggingface.co/datasets/Veweew/stack-parquet/resolve/main/schema.sql
11.8 kB
| -- | |
| -- Name: account; Type: TABLE; Schema: public; Owner: postgres | |
| -- | |
| CREATE TABLE public.account ( | |
| id integer NOT NULL, | |
| display_name character varying, | |
| location character varying, | |
| about_me character varying, | |
| website_url character varying | |
| ); | |
| -- | |
| -- Name: answer; Type: TABLE; Schema: public; Owner: postgres | |
| -- | |
| CREATE TABLE public.answer ( | |
| id integer NOT NULL, | |
| site_id integer NOT NULL, | |
| question_id integer, | |
| creation_date timestamp without time zone, | |
| deletion_date timestamp without time zone, | |
| score integer, | |
| view_count integer, | |
| body character varying, | |
| owner_user_id integer, | |
| last_editor_id integer, | |
| last_edit_date timestamp without time zone, | |
| last_activity_date timestamp without time zone, | |
| title character varying | |
| ); | |
| -- | |
| -- Name: badge; Type: TABLE; Schema: public; Owner: postgres | |
| -- | |
| CREATE TABLE public.badge ( | |
| site_id integer NOT NULL, | |
| user_id integer NOT NULL, | |
| name character varying NOT NULL, | |
| date timestamp without time zone NOT NULL | |
| ); | |
| -- | |
| -- Name: comment; Type: TABLE; Schema: public; Owner: postgres | |
| -- | |
| CREATE TABLE public.comment ( | |
| id integer NOT NULL, | |
| site_id integer NOT NULL, | |
| post_id integer, | |
| user_id integer, | |
| score integer, | |
| body character varying, | |
| date timestamp without time zone | |
| ); | |
| -- | |
| -- Name: post_link; Type: TABLE; Schema: public; Owner: postgres | |
| -- | |
| CREATE TABLE public.post_link ( | |
| site_id integer NOT NULL, | |
| post_id_from integer NOT NULL, | |
| post_id_to integer NOT NULL, | |
| link_type integer NOT NULL, | |
| date timestamp without time zone | |
| ); | |
| -- | |
| -- Name: question; Type: TABLE; Schema: public; Owner: postgres | |
| -- | |
| CREATE TABLE public.question ( | |
| id integer NOT NULL, | |
| site_id integer NOT NULL, | |
| accepted_answer_id integer, | |
| creation_date timestamp without time zone, | |
| deletion_date timestamp without time zone, | |
| score integer, | |
| view_count integer, | |
| body character varying, | |
| owner_user_id integer, | |
| last_editor_id integer, | |
| last_edit_date timestamp without time zone, | |
| last_activity_date timestamp without time zone, | |
| title character varying, | |
| favorite_count integer, | |
| closed_date timestamp without time zone, | |
| tagstring character varying | |
| ); | |
| -- | |
| -- Name: site; Type: TABLE; Schema: public; Owner: postgres | |
| -- | |
| CREATE TABLE public.site ( | |
| site_id integer NOT NULL, | |
| site_name character varying | |
| ); | |
| -- | |
| -- Name: so_user; Type: TABLE; Schema: public; Owner: postgres | |
| -- | |
| CREATE TABLE public.so_user ( | |
| id integer NOT NULL, | |
| site_id integer NOT NULL, | |
| reputation integer, | |
| creation_date timestamp without time zone, | |
| last_access_date timestamp without time zone, | |
| upvotes integer, | |
| downvotes integer, | |
| account_id integer | |
| ); | |
| -- | |
| -- Name: tag; Type: TABLE; Schema: public; Owner: postgres | |
| -- | |
| CREATE TABLE public.tag ( | |
| id integer NOT NULL, | |
| site_id integer NOT NULL, | |
| name character varying | |
| ); | |
| -- | |
| -- Name: tag_question; Type: TABLE; Schema: public; Owner: postgres | |
| -- | |
| CREATE TABLE public.tag_question ( | |
| question_id integer NOT NULL, | |
| tag_id integer NOT NULL, | |
| site_id integer NOT NULL | |
| ); | |
| -- | |
| -- Name: account account_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.account | |
| ADD CONSTRAINT account_pkey PRIMARY KEY (id); | |
| -- | |
| -- Name: answer answer_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.answer | |
| ADD CONSTRAINT answer_pkey PRIMARY KEY (id, site_id); | |
| -- | |
| -- Name: badge badge_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.badge | |
| ADD CONSTRAINT badge_pkey PRIMARY KEY (site_id, user_id, name, date); | |
| -- | |
| -- Name: comment comment_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.comment | |
| ADD CONSTRAINT comment_pkey PRIMARY KEY (id, site_id); | |
| -- | |
| -- Name: post_link post_link_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.post_link | |
| ADD CONSTRAINT post_link_pkey PRIMARY KEY (site_id, post_id_from, post_id_to, link_type); | |
| -- | |
| -- Name: question question_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.question | |
| ADD CONSTRAINT question_pkey PRIMARY KEY (id, site_id); | |
| -- | |
| -- Name: site site_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.site | |
| ADD CONSTRAINT site_pkey PRIMARY KEY (site_id); | |
| -- | |
| -- Name: so_user so_user_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.so_user | |
| ADD CONSTRAINT so_user_pkey PRIMARY KEY (id, site_id); | |
| -- | |
| -- Name: tag tag_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.tag | |
| ADD CONSTRAINT tag_pkey PRIMARY KEY (id, site_id); | |
| -- | |
| -- Name: tag_question tag_question_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.tag_question | |
| ADD CONSTRAINT tag_question_pkey PRIMARY KEY (site_id, question_id, tag_id); | |
| -- | |
| -- Name: answer_creation_date_idx; Type: INDEX; Schema: public; Owner: postgres | |
| -- | |
| CREATE INDEX answer_creation_date_idx ON public.answer USING btree (creation_date); | |
| -- | |
| -- Name: answer_last_editor_id_idx; Type: INDEX; Schema: public; Owner: postgres | |
| -- | |
| CREATE INDEX answer_last_editor_id_idx ON public.answer USING btree (last_editor_id); | |
| -- | |
| -- Name: answer_owner_user_id_idx; Type: INDEX; Schema: public; Owner: postgres | |
| -- | |
| CREATE INDEX answer_owner_user_id_idx ON public.answer USING btree (owner_user_id); | |
| -- | |
| -- Name: answer_site_id_question_id_idx; Type: INDEX; Schema: public; Owner: postgres | |
| -- | |
| CREATE INDEX answer_site_id_question_id_idx ON public.answer USING btree (site_id, question_id); | |
| -- | |
| -- Name: comment_site_id_post_id_idx; Type: INDEX; Schema: public; Owner: postgres | |
| -- | |
| CREATE INDEX comment_site_id_post_id_idx ON public.comment USING btree (site_id, post_id); | |
| -- | |
| -- Name: comment_site_id_user_id_idx; Type: INDEX; Schema: public; Owner: postgres | |
| -- | |
| CREATE INDEX comment_site_id_user_id_idx ON public.comment USING btree (site_id, user_id); | |
| -- | |
| -- Name: question_creation_date_idx; Type: INDEX; Schema: public; Owner: postgres | |
| -- | |
| CREATE INDEX question_creation_date_idx ON public.question USING btree (creation_date); | |
| -- | |
| -- Name: question_last_editor_id_idx; Type: INDEX; Schema: public; Owner: postgres | |
| -- | |
| CREATE INDEX question_last_editor_id_idx ON public.question USING btree (last_editor_id); | |
| -- | |
| -- Name: question_owner_user_id_idx; Type: INDEX; Schema: public; Owner: postgres | |
| -- | |
| CREATE INDEX question_owner_user_id_idx ON public.question USING btree (owner_user_id); | |
| -- | |
| -- Name: so_user_creation_date_idx; Type: INDEX; Schema: public; Owner: postgres | |
| -- | |
| CREATE INDEX so_user_creation_date_idx ON public.so_user USING btree (creation_date); | |
| -- | |
| -- Name: so_user_last_access_date_idx; Type: INDEX; Schema: public; Owner: postgres | |
| -- | |
| CREATE INDEX so_user_last_access_date_idx ON public.so_user USING btree (last_access_date); | |
| -- | |
| -- Name: tag_question_site_id_tag_id_question_id_idx; Type: INDEX; Schema: public; Owner: postgres | |
| -- | |
| CREATE INDEX tag_question_site_id_tag_id_question_id_idx ON public.tag_question USING btree (site_id, tag_id, question_id); | |
| -- | |
| -- Name: answer answer_site_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.answer | |
| ADD CONSTRAINT answer_site_id_fkey FOREIGN KEY (site_id) REFERENCES public.site(site_id); | |
| -- | |
| -- Name: answer answer_site_id_fkey1; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.answer | |
| ADD CONSTRAINT answer_site_id_fkey1 FOREIGN KEY (site_id, owner_user_id) REFERENCES public.so_user(site_id, id); | |
| -- | |
| -- Name: answer answer_site_id_fkey2; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.answer | |
| ADD CONSTRAINT answer_site_id_fkey2 FOREIGN KEY (site_id, last_editor_id) REFERENCES public.so_user(site_id, id); | |
| -- | |
| -- Name: answer answer_site_id_fkey3; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.answer | |
| ADD CONSTRAINT answer_site_id_fkey3 FOREIGN KEY (site_id, question_id) REFERENCES public.question(site_id, id); | |
| -- | |
| -- Name: badge badge_site_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.badge | |
| ADD CONSTRAINT badge_site_id_fkey FOREIGN KEY (site_id) REFERENCES public.site(site_id); | |
| -- | |
| -- Name: badge badge_site_id_fkey1; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.badge | |
| ADD CONSTRAINT badge_site_id_fkey1 FOREIGN KEY (site_id, user_id) REFERENCES public.so_user(site_id, id); | |
| -- | |
| -- Name: comment comment_site_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.comment | |
| ADD CONSTRAINT comment_site_id_fkey FOREIGN KEY (site_id) REFERENCES public.site(site_id); | |
| -- | |
| -- Name: post_link post_link_site_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.post_link | |
| ADD CONSTRAINT post_link_site_id_fkey FOREIGN KEY (site_id) REFERENCES public.site(site_id); | |
| -- | |
| -- Name: post_link post_link_site_id_fkey1; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.post_link | |
| ADD CONSTRAINT post_link_site_id_fkey1 FOREIGN KEY (site_id, post_id_to) REFERENCES public.question(site_id, id); | |
| -- | |
| -- Name: post_link post_link_site_id_fkey2; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.post_link | |
| ADD CONSTRAINT post_link_site_id_fkey2 FOREIGN KEY (site_id, post_id_from) REFERENCES public.question(site_id, id); | |
| -- | |
| -- Name: question question_site_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.question | |
| ADD CONSTRAINT question_site_id_fkey FOREIGN KEY (site_id) REFERENCES public.site(site_id); | |
| -- | |
| -- Name: question question_site_id_fkey1; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.question | |
| ADD CONSTRAINT question_site_id_fkey1 FOREIGN KEY (site_id, owner_user_id) REFERENCES public.so_user(site_id, id); | |
| -- | |
| -- Name: question question_site_id_fkey2; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.question | |
| ADD CONSTRAINT question_site_id_fkey2 FOREIGN KEY (site_id, last_editor_id) REFERENCES public.so_user(site_id, id); | |
| -- | |
| -- Name: so_user so_user_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.so_user | |
| ADD CONSTRAINT so_user_account_id_fkey FOREIGN KEY (account_id) REFERENCES public.account(id); | |
| -- | |
| -- Name: so_user so_user_site_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.so_user | |
| ADD CONSTRAINT so_user_site_id_fkey FOREIGN KEY (site_id) REFERENCES public.site(site_id); | |
| -- | |
| -- Name: tag_question tag_question_site_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.tag_question | |
| ADD CONSTRAINT tag_question_site_id_fkey FOREIGN KEY (site_id) REFERENCES public.site(site_id); | |
| -- | |
| -- Name: tag_question tag_question_site_id_fkey1; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.tag_question | |
| ADD CONSTRAINT tag_question_site_id_fkey1 FOREIGN KEY (site_id, tag_id) REFERENCES public.tag(site_id, id); | |
| -- | |
| -- Name: tag_question tag_question_site_id_fkey2; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.tag_question | |
| ADD CONSTRAINT tag_question_site_id_fkey2 FOREIGN KEY (site_id, question_id) REFERENCES public.question(site_id, id) ON DELETE CASCADE; | |
| -- | |
| -- Name: tag tag_site_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres | |
| -- | |
| ALTER TABLE ONLY public.tag | |
| ADD CONSTRAINT tag_site_id_fkey FOREIGN KEY (site_id) REFERENCES public.site(site_id); | |