https://github.com/bigbuildbench/seaql_sea-schema
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.1%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: BigBuildBench
- License: apache-2.0
- Language: Rust
- Default Branch: master
- Size: 3.69 MB
Statistics
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
SeaSchema
🌿 SQL schema definition and discovery
[](https://crates.io/crates/sea-schema) [](https://docs.rs/sea-schema) [](https://github.com/SeaQL/sea-schema/actions/workflows/rust.yml)About
SeaSchema is a library to help you manage database schema for MySQL, Postgres and SQLite. It provides 1) type definitions for representing database schema mapping each database closely and 2) utilities to discover them.
If you like what we do, consider starring, commenting, sharing and contributing!
Join our Discord server to chat with others in the SeaQL community!
Architecture
The crate is divided into different modules:
def: type definitionsquery,parser: for querying and parsing information_schemadiscovery: connect to a live database and discover aSchemawriter: for exportingSchemainto SeaQuery and SQL statements
JSON de/serialize on type definitions can be enabled with with-serde.
Schema Discovery
Take the MySQL Sakila Sample Database as example, given the following table:
``SQL
CREATE TABLE film_actor (
actor_id SMALLINT UNSIGNED NOT NULL,
film_id SMALLINT UNSIGNED NOT NULL,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (actor_id,film_id),
KEY idx_fk_film_id (filmid`),
CONSTRAINT fkfilmactoractor FOREIGN KEY (actorid) REFERENCES actor (actorid) ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT fkfilmactorfilm FOREIGN KEY (filmid) REFERENCES film (film_id) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
```
rust
TableDef {
info: TableInfo {
name: "film_actor",
engine: InnoDb,
auto_increment: None,
char_set: Utf8Mb4,
collation: Utf8Mb40900AiCi,
comment: "",
},
columns: [
ColumnInfo {
name: "actor_id",
col_type: SmallInt(
NumericAttr {
maximum: None,
decimal: None,
unsigned: Some(true),
zero_fill: None,
},
),
null: false,
key: Primary,
default: None,
extra: ColumnExtra {
auto_increment: false,
on_update_current_timestamp: false,
generated: false,
default_generated: false,
},
expression: None,
comment: "",
},
ColumnInfo {
name: "film_id",
col_type: SmallInt(
NumericAttr {
maximum: None,
decimal: None,
unsigned: Some(true),
zero_fill: None,
},
),
null: false,
key: Primary,
default: None,
extra: ColumnExtra {
auto_increment: false,
on_update_current_timestamp: false,
generated: false,
default_generated: false,
},
expression: None,
comment: "",
},
ColumnInfo {
name: "last_update",
col_type: Timestamp(TimeAttr { fractional: None }),
null: false,
key: NotKey,
default: Some(ColumnDefault::CurrentTimestamp),
extra: ColumnExtra {
auto_increment: false,
on_update_current_timestamp: true,
generated: false,
default_generated: true,
},
expression: None,
comment: "",
},
],
indexes: [
IndexInfo {
unique: false,
name: "idx_fk_film_id",
parts: [
IndexPart {
column: "film_id",
order: Ascending,
sub_part: None,
},
],
nullable: false,
idx_type: BTree,
comment: "",
functional: false,
},
IndexInfo {
unique: true,
name: "PRIMARY",
parts: [
IndexPart {
column: "actor_id",
order: Ascending,
sub_part: None,
},
IndexPart {
column: "film_id",
order: Ascending,
sub_part: None,
},
],
nullable: false,
idx_type: BTree,
comment: "",
functional: false,
},
],
foreign_keys: [
ForeignKeyInfo {
name: "fk_film_actor_actor",
columns: [ "actor_id" ],
referenced_table: "actor",
referenced_columns: [ "actor_id" ],
on_update: Cascade,
on_delete: Restrict,
},
ForeignKeyInfo {
name: "fk_film_actor_film",
columns: [ "film_id" ],
referenced_table: "film",
referenced_columns: [ "film_id" ],
on_update: Cascade,
on_delete: Restrict,
},
],
}
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
SeaSchema is a community driven project. We welcome you to participate, contribute and together build for Rust's future.
A big shout out to our contributors:
Owner
- Name: BigBuildBench
- Login: BigBuildBench
- Kind: organization
- Repositories: 1
- Profile: https://github.com/BigBuildBench
abbr. B3, benchmarking the repo-level understanding capability of your LLMs by reconstructing project build-file.
GitHub Events
Total
- Create event: 5
Last Year
- Create event: 5
Dependencies
- billy1624/release-comment-on-pr master composite
- actions/cache v4 composite
- actions/checkout v4 composite
- dtolnay/rust-toolchain master composite
- dtolnay/rust-toolchain stable composite
- mariadb ${{ matrix.version }} docker
- mysql ${{ matrix.version }} docker
- postgres ${{ matrix.version }} docker
- doctrine/dbal ^3.0
- composer/package-versions-deprecated 1.11.99.1
- doctrine/cache 1.10.2
- doctrine/dbal 3.0.0
- doctrine/event-manager 1.1.1