Skip to content

Conversation

@quffaro
Copy link
Collaborator

@quffaro quffaro commented Nov 10, 2025

No description provided.

@quffaro quffaro added the enhancement New feature or request label Nov 10, 2025
@epatters epatters added the external Work on interfacing with other tools label Nov 24, 2025
@quffaro quffaro marked this pull request as ready for review December 5, 2025 01:41
@kasbah

This comment was marked as outdated.

@github-actions github-actions bot temporarily deployed to netlify-preview January 5, 2026 15:52 Destroyed
@github-actions github-actions bot temporarily deployed to netlify-preview January 5, 2026 15:57 Destroyed
@github-actions github-actions bot temporarily deployed to netlify-preview January 5, 2026 16:00 Destroyed
Copy link
Member

@epatters epatters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Matt, and sorry for the long delay in returning a review. I'm excited about this feature!

I've left a first round of comments below. I'll likely have more feedback (I haven't tested anything yet :) but I wanted to get you something now.

/// Tries to returns the morphism namespace
pub fn mor_namespace(&self) -> Result<Namespace, String> {
Ok(self.mor_namespace.clone())
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple issues with these methods: (1) they shouldn't return a Result because they are infallible and (2) they shouldn't clone because they should just be used for lookup, which doesn't require ownership.

In fact, you should be able to avoid exposing this data at all; see below.

use sqlformat::{Dialect, format};
use std::fmt;

impl Namespace {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this impl. (Should be a code smell to be adding this here.)


impl SQLAnalysis {
/// Constructs a new SQLAnalysis instance
pub fn new(obns: Namespace, morns: Namespace, backend: &str) -> Result<SQLAnalysis, String> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace parameter obns: Namespace with

ob_label: impl Fn(&QualifiedName) -> QualifiedLabel

and similarly for morphism labels.


export function downloadTextContent(text: string, filename: string) {
return download(text, filename, "text/plain");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why export this function? It's only used once anyway; would suggest just deleting it.

use crate::{
one::Path,
zero::{Namespace, name},
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish rustfmt did it automatically, but alas: these imports look messy, please clean them up a bit.

.obns
.clone()
.label_name(model.get_cod(mor).unwrap_or(&name("")).clone());
match format!("{}", tgt_name.clone()).as_str() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest moving this deeply nested match to a helper function for rendering attribute types.

There's also a certain amount of redundancy in the cases (ColumnDef::new(...)) that could likely be eliminated by refactoring the code slightly.

use std::rc::Rc;
use tattle::Reporter;

impl DiscreteDblModel {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not your fault this feature wasn't properly exposed, but regardless this impl shouldn't be here. I'll see if I can improve that separately.

@epatters epatters changed the title SQL Analysis Generate SQL schema definition from CatColab schema Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request external Work on interfacing with other tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants