Skip to content

add mysql backend support#393

Merged
Bl3f merged 9 commits intogetnao:mainfrom
teoria:feat/211-add_mysql_support
Mar 19, 2026
Merged

add mysql backend support#393
Bl3f merged 9 commits intogetnao:mainfrom
teoria:feat/211-add_mysql_support

Conversation

@teoria
Copy link
Copy Markdown
Contributor

@teoria teoria commented Mar 3, 2026

#211
add mysql backend support

Copy link
Copy Markdown
Contributor

@Bl3f Bl3f left a comment

Choose a reason for hiding this comment

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

Look almost good to me thank you so much. Can you as well add an integration test for MySQL like the other providers in cli/tests/nao_core/commands/sync/integration folder?

Comment thread docker-compose.mysql.yml Outdated
@@ -0,0 +1,20 @@
services:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

instead of creating this, the best would be to merge into a docker-compose.test.yml every database that can be embed in a Docker component, so we don't finish with an endless list of docker-compose files.

@Jayjaejae
Copy link
Copy Markdown

@teoria Could you share any update on this pr? I also need MySQL support!

@teoria
Copy link
Copy Markdown
Contributor Author

teoria commented Mar 16, 2026

@teoria Could you share any update on this pr? I also need MySQL support!

I needed to add a new dependency to the Dockerfile.
I'll update the PR now.
Thanks for reminding me.

@teoria
Copy link
Copy Markdown
Contributor Author

teoria commented Mar 18, 2026

  • name: mysql_prod
    type: mysql
    host: ${MYSQL_HOST:-localhost}
    port: 3306
    database: ${MYSQL_DATABASE}
    user: ${MYSQL_USER}
    password: ${MYSQL_PASSWORD}

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 18, 2026

🧹 Preview Removed

The preview deployment for this PR has been cleaned up.

@Bl3f Bl3f marked this pull request as ready for review March 19, 2026 08:53
@Bl3f Bl3f merged commit 552a0ba into getnao:main Mar 19, 2026
3 checks passed
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 8 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="Dockerfile">

<violation number="1" location="Dockerfile:72">
P1: MySQL/MariaDB client library is only installed in builder stage, so compiled MySQL Python backend can fail at runtime due to missing shared libs in final image.</violation>
</file>

<file name="cli/tests/nao_core/commands/sync/integration/test_mysql.py">

<violation number="1" location="cli/tests/nao_core/commands/sync/integration/test_mysql.py:68">
P2: MySQL integration fixture suppresses SQL seed failures, allowing setup to continue with a potentially incomplete database.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread Dockerfile
gcc \
unixodbc-dev \
pkg-config \
libmariadb-dev \
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Mar 19, 2026

Choose a reason for hiding this comment

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

P1: MySQL/MariaDB client library is only installed in builder stage, so compiled MySQL Python backend can fail at runtime due to missing shared libs in final image.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At Dockerfile, line 72:

<comment>MySQL/MariaDB client library is only installed in builder stage, so compiled MySQL Python backend can fail at runtime due to missing shared libs in final image.</comment>

<file context>
@@ -65,9 +65,13 @@ WORKDIR /app
+    gcc \
     unixodbc-dev \
+    pkg-config \
+    libmariadb-dev \
     && rm -rf /var/lib/apt/lists/*
-
</file context>
Fix with Cubic

if statement:
try:
conn.raw_sql(statement).fetchall()
except Exception:
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Mar 19, 2026

Choose a reason for hiding this comment

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

P2: MySQL integration fixture suppresses SQL seed failures, allowing setup to continue with a potentially incomplete database.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At cli/tests/nao_core/commands/sync/integration/test_mysql.py, line 68:

<comment>MySQL integration fixture suppresses SQL seed failures, allowing setup to continue with a potentially incomplete database.</comment>

<file context>
@@ -0,0 +1,144 @@
+            if statement:
+                try:
+                    conn.raw_sql(statement).fetchall()
+                except Exception:
+                    pass
+
</file context>
Fix with Cubic

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Preview Deployment

URL https://pr-393-97c884e.preview.getnao.io
Commit 97c884e

⚠️ No LLM API keys configured - you'll see the API key setup flow when trying to chat.


Preview will be automatically removed when this PR is closed.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 5 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="Dockerfile">

<violation number="1" location="Dockerfile:72">
P1: MySQL client native library is compiled in the builder but missing from runtime image, which can cause MySQL backend import/linker failures at runtime.</violation>
</file>

<file name="cli/nao_core/config/databases/mysql.py">

<violation number="1" location="cli/nao_core/config/databases/mysql.py:20">
P2: MySQL identifier quoting is unsafe because `_quote()` does not escape embedded backticks before interpolating identifiers into raw SQL.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread Dockerfile
gcc \
unixodbc-dev \
pkg-config \
libmariadb-dev \
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Mar 19, 2026

Choose a reason for hiding this comment

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

P1: MySQL client native library is compiled in the builder but missing from runtime image, which can cause MySQL backend import/linker failures at runtime.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At Dockerfile, line 72:

<comment>MySQL client native library is compiled in the builder but missing from runtime image, which can cause MySQL backend import/linker failures at runtime.</comment>

<file context>
@@ -65,9 +65,13 @@ WORKDIR /app
+    gcc \
     unixodbc-dev \
+    pkg-config \
+    libmariadb-dev \
     && rm -rf /var/lib/apt/lists/*
-
</file context>
Fix with Cubic

"""MySQL context with information_schema description discovery."""

def _quote(self, name: str) -> str:
return f"`{name}`"
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Mar 19, 2026

Choose a reason for hiding this comment

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

P2: MySQL identifier quoting is unsafe because _quote() does not escape embedded backticks before interpolating identifiers into raw SQL.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At cli/nao_core/config/databases/mysql.py, line 20:

<comment>MySQL identifier quoting is unsafe because `_quote()` does not escape embedded backticks before interpolating identifiers into raw SQL.</comment>

<file context>
@@ -16,6 +16,9 @@
     """MySQL context with information_schema description discovery."""
 
+    def _quote(self, name: str) -> str:
+        return f"`{name}`"
+
     def description(self) -> str | None:
</file context>
Suggested change
return f"`{name}`"
return f"`{name.replace('`', '``')}`"
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants