Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
~
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down Expand Up @@ -60,6 +60,13 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>${flyway.version}</version>
</plugin>

</plugins>
</build>

Expand All @@ -79,9 +86,9 @@
</dependency>

<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<!--compile "org.springframework.boot:spring-boot-starter-web:${springBootVersion}"-->
<dependency>
Expand Down Expand Up @@ -241,5 +248,10 @@
<version>6.1.2.Final</version>
</dependency>

<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>${flyway.version}</version>
</dependency>
</dependencies>
</project>
6 changes: 5 additions & 1 deletion core/src/main/java/feast/core/model/FeatureSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,13 @@ public class FeatureSet extends AbstractTimestampEntity {

// Source on which feature rows can be found
@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "source")
@JoinColumn(name = "source_id", referencedColumnName = "pk")
private Source source;

@Deprecated
@Column(name = "source")
private String deprecatedSource;

// Status of the feature set
@Enumerated(EnumType.STRING)
@Column(name = "status")
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/feast/core/model/Job.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public JobBuilder setSource(Source source) {
private Runner runner;

// Source type and config, derieved from job's source and stored as inline fields.
@Enumerated(EnumType.STRING)
@Column(name = "source_type")
private SourceType sourceType;

Expand Down
30 changes: 29 additions & 1 deletion core/src/main/java/feast/core/model/Source.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,22 @@
public class Source {

/** Source Id. Internal use only, do not use to identify the source. */
@Id @GeneratedValue private long id;
@Id
@GeneratedValue
@Column(name = "pk")
private Integer id;

@Deprecated
@Column(name = "id")
private String deprecatedId;

@Deprecated
@Column(name = "bootstrap_servers")
private String bootstrapServers;

@Deprecated
@Column(name = "topics")
private String topics;

/** Type of the source */
@Enumerated(EnumType.STRING)
Expand All @@ -55,6 +70,19 @@ public Source() {
super();
}

public String getConfig() {
if ((config == null || config.isEmpty()) && bootstrapServers != null && topics != null) {
config =
KafkaSourceConfig.newBuilder()
.setBootstrapServers(bootstrapServers)
.setTopic(topics)
.build()
.toString();
}

return config;
}

/**
* Construct a source facade object from a given proto object.
*
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,14 @@ spring:
merge:
entity_copy_observer: allow
hibernate.naming.physical-strategy=org.hibernate.boot.model.naming: PhysicalNamingStrategyStandardImpl
hibernate.ddl-auto: update
hibernate.ddl-auto: validate
datasource:
driverClassName: org.postgresql.Driver
url: jdbc:postgresql://${DB_HOST:127.0.0.1}:${DB_PORT:5432}/${DB_DATABASE:postgres}
username: ${DB_USERNAME:postgres}
password: ${DB_PASSWORD:password}
flyway:
baseline-on-migrate: true

management:
metrics:
Expand Down
185 changes: 185 additions & 0 deletions core/src/main/resources/db/migration/V1__Baseline.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
--
-- Dump of Feast Database (as of RELEASE 0.5)
-- Baseline dump for migrating to flyway
--


SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET default_tablespace = '';


CREATE TABLE entities (
id bigint NOT NULL,
name character varying(255),
type character varying(255),
feature_set_id bigint
);


CREATE TABLE feature_sets (
id bigint NOT NULL,
created timestamp without time zone NOT NULL,
last_updated timestamp without time zone NOT NULL,
labels text,
max_age bigint,
name character varying(255) NOT NULL,
status character varying(255),
project_name character varying(255),
source character varying(255)
);


CREATE TABLE features (
id bigint NOT NULL,
archived boolean NOT NULL,
bool_domain bytea,
domain character varying(255),
float_domain bytea,
group_presence bytea,
image_domain bytea,
int_domain bytea,
labels text,
mid_domain bytea,
name character varying(255),
natural_language_domain bytea,
presence bytea,
shape bytea,
string_domain bytea,
struct_domain bytea,
time_domain bytea,
time_of_day_domain bytea,
type character varying(255),
url_domain bytea,
value_count bytea,
feature_set_id bigint
);



CREATE SEQUENCE hibernate_sequence
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;


CREATE TABLE jobs (
id character varying(255) NOT NULL,
created timestamp without time zone NOT NULL,
last_updated timestamp without time zone NOT NULL,
ext_id character varying(255),
runner character varying(255),
status character varying(16),
source_id character varying(255),
store_name character varying(255)
);


CREATE TABLE jobs_feature_sets (
job_id character varying(255) NOT NULL,
feature_sets_id bigint NOT NULL
);


CREATE TABLE projects (
name character varying(255) NOT NULL,
archived boolean NOT NULL
);


CREATE TABLE sources (
id character varying(255) NOT NULL,
bootstrap_servers character varying(255),
is_default boolean,
topics character varying(255),
type character varying(255) NOT NULL
);


CREATE TABLE stores (
name character varying(255) NOT NULL,
config oid NOT NULL,
subscriptions character varying(255),
type character varying(255) NOT NULL
);


ALTER TABLE ONLY entities
ADD CONSTRAINT entities_pkey PRIMARY KEY (id);


ALTER TABLE ONLY feature_sets
ADD CONSTRAINT feature_sets_pkey PRIMARY KEY (id);


ALTER TABLE ONLY features
ADD CONSTRAINT features_pkey PRIMARY KEY (id);


ALTER TABLE ONLY jobs
ADD CONSTRAINT jobs_pkey PRIMARY KEY (id);


ALTER TABLE ONLY projects
ADD CONSTRAINT projects_pkey PRIMARY KEY (name);


ALTER TABLE ONLY sources
ADD CONSTRAINT sources_pkey PRIMARY KEY (id);


ALTER TABLE ONLY stores
ADD CONSTRAINT stores_pkey PRIMARY KEY (name);


ALTER TABLE ONLY entities
ADD CONSTRAINT uk4hredqqfh86prhp1hf08nofvk UNIQUE (name, feature_set_id);


ALTER TABLE ONLY features
ADD CONSTRAINT ukedouxmpcoev743cmstfwq25yp UNIQUE (name, feature_set_id);


ALTER TABLE ONLY feature_sets
ADD CONSTRAINT ukoajkc7tn9nwhodjrbcjri5jix UNIQUE (name, project_name);


CREATE INDEX idx_jobs_feature_sets_feature_sets_id ON jobs_feature_sets USING btree (feature_sets_id);

CREATE INDEX idx_jobs_feature_sets_job_id ON jobs_feature_sets USING btree (job_id);


ALTER TABLE ONLY feature_sets
ADD CONSTRAINT fk2di8f74x6wir076hrfbyi1qfh FOREIGN KEY (source) REFERENCES sources(id);


ALTER TABLE ONLY jobs_feature_sets
ADD CONSTRAINT fk2qt5yj45cr02spdhp59h4wpeg FOREIGN KEY (job_id) REFERENCES jobs(id);


ALTER TABLE ONLY jobs
ADD CONSTRAINT fk3dwuno3phk8j3iwdl4cckdqqd FOREIGN KEY (store_name) REFERENCES stores(name);


ALTER TABLE ONLY features
ADD CONSTRAINT fkfxcpsscvj0g89o4p5dx4insb1 FOREIGN KEY (feature_set_id) REFERENCES feature_sets(id);


ALTER TABLE ONLY jobs
ADD CONSTRAINT fkhkfwvhc2gei0wqw5h4mfvsy9f FOREIGN KEY (source_id) REFERENCES sources(id);


ALTER TABLE ONLY entities
ADD CONSTRAINT fkhyblh5sfunv00a8ums8ms9otq FOREIGN KEY (feature_set_id) REFERENCES feature_sets(id);


ALTER TABLE ONLY feature_sets
ADD CONSTRAINT fkiiqcdeuuq9mf0tmt7jtnln3oa FOREIGN KEY (project_name) REFERENCES projects(name);


ALTER TABLE ONLY jobs_feature_sets
ADD CONSTRAINT fkroca9etjw89c48e8jays6jl4l FOREIGN KEY (feature_sets_id) REFERENCES feature_sets(id);
Loading