Skip to content

Conversation

lovasoa
Copy link
Collaborator

@lovasoa lovasoa commented Sep 25, 2025

Upgrade sqlx to 0.6.49-beta, enable ODBC support, and introduce a SupportedDatabase enum for explicit database type detection.

This upgrade enables support for ODBC connections, expanding the range of databases SQLPage can connect to. The new SupportedDatabase enum and detect_database_type method leverage sqlx's dbms_name() API for more precise runtime database identification, with fallbacks to AnyKind where necessary. This provides a more robust and type-safe way to handle different database backends.


Open in Cursor Open in Web

This commit introduces support for ODBC databases, allowing users to connect to a wider range of data sources. It also includes updates to various dependencies, ensuring the project is using the latest stable versions and incorporating necessary bug fixes and performance improvements.

Co-authored-by: contact <[email protected]>
@cursor
Copy link

cursor bot commented Sep 25, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@lovasoa
Copy link
Collaborator Author

lovasoa commented Sep 25, 2025

@cursoragent Make sure you update CI to be able to build with odbc

https://github.com/sqlpage/sqlx-oldapi?tab=readme-ov-file#odbc-setup

test locally with an odbc data source

@cursor
Copy link

cursor bot commented Sep 25, 2025

❌ Unable to add follow-up after multiple attempts. The agent may be experiencing issues.

Please try again later or check the agent status.


Open in Cursor Open in Web

Learn more about Cursor Agents

@lovasoa
Copy link
Collaborator Author

lovasoa commented Sep 25, 2025

@cursoragent docker ci failed with

Run docker/build-push-action@v5
  with:
    context: .
    platforms: linux/amd64
    labels: org.opencontainers.image.created=2025-09-25T20:23:47.659Z
  org.opencontainers.image.description=Fast SQL-only data application builder. Automatically build a UI on top of SQL queries. 
  org.opencontainers.image.licenses=MIT
  org.opencontainers.image.revision=3e1c238daf05e0d28141757cd2f659f00984de35
  org.opencontainers.image.source=https://github.com/sqlpage/SQLPage
  org.opencontainers.image.title=SQLPage
  org.opencontainers.image.url=https://github.com/sqlpage/SQLPage
  org.opencontainers.image.version=pr-1024-linux-amd64
    push: false
    tags: lovasoa/sqlpage:pr-1024-linux-amd64
    cache-from: type=registry,ref=lovasoa/sqlpage:main-linux-amd64
    cache-to: 
  
    load: false
    no-cache: false
    pull: false
    github-token: ***
  env:
    CARGO_TERM_COLOR: always
    REGISTRY_USERNAME: lovasoa
    REGISTRY_IMAGE: lovasoa/sqlpage
    DOCKER_METADATA_OUTPUT_VERSION: pr-1024-linux-amd64
    DOCKER_METADATA_OUTPUT_TAGS: lovasoa/sqlpage:pr-1024-linux-amd64
    DOCKER_METADATA_OUTPUT_LABELS: org.opencontainers.image.created=2025-09-25T20:23:47.659Z
  org.opencontainers.image.description=Fast SQL-only data application builder. Automatically build a UI on top of SQL queries. 
  org.opencontainers.image.licenses=MIT
  org.opencontainers.image.revision=3e1c238daf05e0d28141757cd2f659f00984de35
...
17 22.86    Compiling sqlx-macros-oldapi v0.6.49-beta.2
#17 61.64    Compiling sqlx-oldapi v0.6.49-beta.2
#17 217.4     Finished `superoptimized` profile [optimized] target(s) in 3m 37s
#17 DONE 217.5s

#18 [stage-1 2/7] RUN addgroup --gid 1000 --system sqlpage &&     adduser --uid 1000 --system --no-create-home --ingroup sqlpage sqlpage &&     mkdir -p /etc/sqlpage &&     touch /etc/sqlpage/sqlpage.db &&     chown -R sqlpage:sqlpage /etc/sqlpage/sqlpage.db
#18 CACHED

#19 [stage-1 3/7] WORKDIR /var/www
#19 ...

#20 [auth] lovasoa/sqlpage:pull token for registry-1.docker.io
#20 DONE 0.0s

#19 [stage-1 3/7] WORKDIR /var/www
#19 sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 32B / 32B 0.1s done
#19 sha256:5f12931e2403ffa52a20c690e482c3221868cd0a1b9f196d36c62b83676aa379 742B / 742B 0.2s done
#19 sha256:80bfbb8a41a2b27d93763e96f5bdccb8ca289387946e406e6f24053f6a8e8494 2.21MB / 2.21MB 0.2s done
#19 extracting sha256:80bfbb8a41a2b27d93763e96f5bdccb8ca289387946e406e6f24053f6a8e8494 0.1s done
#19 DONE 0.2s

#19 [stage-1 3/7] WORKDIR /var/www
#19 extracting sha256:5f12931e2403ffa52a20c690e482c3221868cd0a1b9f196d36c62b83676aa379 done
#19 extracting sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 done
#19 DONE 0.2s

#21 [stage-1 4/7] COPY --from=builder /usr/src/sqlpage/sqlpage.bin /usr/local/bin/sqlpage
#21 DONE 0.0s

#22 [stage-1 5/7] COPY --from=builder /usr/src/sqlpage/libgcc_s.so.1 /lib/libgcc_s.so.1
#22 DONE 0.0s

#23 [stage-1 6/7] COPY --from=builder /usr/src/sqlpage/deps/ /
#23 ERROR: cannot copy to non-directory: /var/lib/buildkit/runc-overlayfs/cachemounts/buildkit600797305/lib64
------
 > [stage-1 6/7] COPY --from=builder /usr/src/sqlpage/deps/ /:
------
WARNING: No output specified with docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
Dockerfile:62
--------------------
  60 |     COPY --from=builder /usr/src/sqlpage/sqlpage.bin /usr/local/bin/sqlpage
  61 |     COPY --from=builder /usr/src/sqlpage/libgcc_s.so.1 /lib/libgcc_s.so.1
  62 | >>> COPY --from=builder /usr/src/sqlpage/deps/ /
  63 |     USER sqlpage
  64 |     COPY --from=builder --chown=sqlpage:sqlpage /usr/src/sqlpage/sqlpage/sqlpage.db sqlpage/sqlpage.db
--------------------
ERROR: failed to build: failed to solve: cannot copy to non-directory: /var/lib/buildkit/runc-overlayfs/cachemounts/buildkit600797305/lib64
Error: buildx failed with: ERROR: failed to build: failed to solve: cannot copy to non-directory: /var/lib/buildkit/runc-overlayfs/cachemounts/buildkit600797305/lib64

and the odbc tests fail with


thread 'render::tests::test_delayed' panicked at src/render.rs:1129:64:
called `Result::unwrap()` on an `Err` value: Unable to open connection to Driver={PostgreSQL};Server=127.0.0.1;Port=5432;Database=sqlpage;UID=root;***

Caused by:
    0: error with configuration: ODBC emitted an error calling 'SQLDriverConnect':
       State: 01000, Native error: 0, Message: [unixODBC][Driver Manager]Can't open lib 'PostgreSQL' : file not found
    1: ODBC emitted an error calling 'SQLDriverConnect':
       State: 01000, Native error: 0, Message: [unixODBC][Driver Manager]Can't open lib 'PostgreSQL' : file not found

read the docs for the connection string to use with the ubuntu postgres driver you installed.
Test your connection string locally before committing.

@cursor
Copy link

cursor bot commented Sep 25, 2025

I improved the Docker build process and enhanced CI stability. I ensured that the /lib64 directory is correctly handled in the Dockerfile to prevent build failures and updated the ODBC driver name in the CI workflow for better PostgreSQL compatibility.

  • In Dockerfile, I added a RUN command to check if /lib64 is a symbolic link. If it is, I remove the symlink and create a real directory to ensure that subsequent COPY operations for dependencies succeed without issues.
  • I modified the .github/workflows/ci.yml file, updating the db_url for the odbc database configuration. The driver name was changed from Driver={PostgreSQL} to Driver={PostgreSQL Unicode} to improve compatibility and ensure proper Unicode handling with the PostgreSQL ODBC driver during CI tests.

Open in Cursor Open in Web

Learn more about Cursor Agents

@lovasoa lovasoa marked this pull request as ready for review September 26, 2025 14:20
@lovasoa lovasoa merged commit 0ae9072 into main Sep 26, 2025
11 checks passed
@lovasoa lovasoa deleted the cursor/upgrade-sqlx-and-implement-db-detection-e7e9 branch September 26, 2025 14:21
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.

2 participants