Budibase / budibase

Low code platform for building business apps and workflows in minutes. Supports PostgreSQL, MySQL, MariaDB, MSSQL, MongoDB, Rest API, Docker, K8s, and more 🚀
https://budibase.com
Other
22.7k stars 1.57k forks source link

Support attachment data type on PostgreSQL (and other external datasources) #4302

Open firdapaz opened 2 years ago

firdapaz commented 2 years ago

Describe the bug Hi, I have image column that have bytea datatype on my postgresql. but when i want to make fields attachment it is always show error "This field setting is wrong data type for this component" What data type i should use for image on my postgresql?

Screenshots

image
mike12345567 commented 2 years ago

Hi @firdapaz - currently attachment fields are not supported for anything other than the internal database - this is something we may look at in the future.

mituBarua commented 2 years ago

Hi @firdapaz - currently attachment fields are not supported for anything other than the internal database - this is something we may look at in the future.

can you explain what do you mean by "internal database" ??

mike12345567 commented 2 years ago

Hi @mituBarua, by internal database I mean the internal tables that can be created within a Budibase app without the need for an external datasource.

You can see these tables marked as "Budibase DB" when creating a new table/datasource. image

mituBarua commented 2 years ago

if i use mysql db ,so how can i attach file?

mike12345567 commented 2 years ago

@mituBarua currently we do not support attachments in any other database, it will be possible to use the "S3 File Upload" component to upload files to the built in MinIO instance, or to some other S3 based environment, but we do not currently support the file/binary column types of any external datasources.

This is the new S3 file upload component, as part of the form components. image

mituBarua commented 2 years ago

ok thanks a lot , i have another query, How can i implement google map getting current location or any other location? Please help regarding this issue also

mituBarua commented 2 years ago

Screenshot from 2022-02-07 19-44-07

i don't understand why S3 File Upload is not showing in my form dropdown.

aptkingston commented 2 years ago

Screenshot from 2022-02-07 19-44-07

i don't understand why S3 File Upload is not showing in my form dropdown.

Hi @mituBarua. Could you check what Budibase version you're using? We only released the S3 upload component recently, so you'll need to update your installation to the latest version, and then also update your app to the latest Budibase client version when that is done. The app can be updated using the arrows icon in the top right of the header, and it will be blue whenever an upgrade is available after you have updated your installation version first.

mituBarua commented 2 years ago

@aptkingston I am using 1.0.46 version of budibase still it is not showing s3 upload. Please help

On Mon, Feb 7, 2022 at 8:15 PM Andrew Kingston @.***> wrote:

[image: Screenshot from 2022-02-07 19-44-07] https://user-images.githubusercontent.com/64905702/152800692-91ee4b4d-2221-4e17-aca5-58286990b9ee.png

i don't understand why S3 File Upload is not showing in my form dropdown.

Hi @mituBarua https://github.com/mituBarua. Could you check what Budibase version you're using? We only released the S3 upload component recently, so you'll need to update your installation to the latest version, and then also update your app to the latest Budibase client version when that is done. The app can be updated using the arrows icon in the top right of the header, and it will be blue whenever an upgrade is available after you have updated your installation version first.

— Reply to this email directly, view it on GitHub https://github.com/Budibase/budibase/issues/4302#issuecomment-1031513930, or unsubscribe https://github.com/notifications/unsubscribe-auth/APPGDZTLURBVONQ6LHPG2FTUZ7HWLANCNFSM5NN47BQQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

efefirda commented 2 years ago

Hi, i already use s3 but my s3 Datasource is empty even i insert inside data provider image

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

aderici commented 2 years ago

I'm using mysql 8.0 which supports json data type. I really would like to use attachments (not aws s3) with my mysql db. Are there any workarounds for this? I should be able to grab the generated json from attachment component and save it to mysql but i can not set it back to the component because it complains data type for component is incompatible. But it actually is.

fizitec commented 1 year ago

Please add attachment fields to external databse

ecxs commented 1 year ago

this would be most useful for me too

shira952 commented 1 year ago

+1 this, either add support for attachment upload to server directory, or allow to add external object db other than AWS (like access to build-in MinIO)

TheFunkyBiskit commented 1 year ago

+1 this. This is a tremendous limitation of Budibase if you're migrating from an existing MySQL database.

bjornclauw commented 1 year ago

I'm using this workaround:

1. Add an attachment component to a form

image (the name for the field value can be anything)

When you see the preview appearing, the file is already uploaded to the internal minio_DB. image

2. Getting the link (2 possibilities)

image

- 2.1 {{ New Form.Fields.attachment.[0].key }}

-> this gets you something like: key=app_4c89fb50ab18fc30fba9895be75647cd/attachments/75f45a0a-4f89-5738-a016-02f215e930e1.png

So url to acces this file: BASEURL/prod-budi-app-assets/key example: www.mybdb.com/prod-budi-app-assets/75f45a0a-4f89-5738-a016-02f215e930e1.png

- 2.2 {{ New Form.Fields.attachment.[0].url }}

-> this gets you something like: URL= /files/signed/prod-budi-app-assets/app_4c89cdab18fc30fba9895bfb50e75647/attachments/75f45a0a-4f89-5738-a016-02f215e930e1.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=supersecret%2F20230304%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230304T221406Z&X-Amz-Expires=3600&X-Amz-Signature=supersecretsignature&X-Amz-SignedHeaders=host

So url to acces this file: BASEURL/URL example: https://www.mybdb.com/files/signed/prod-budi-app-assets/app_4c89fb50e18fc30fba9895b75647cdab/attachments/75f45a0a-5738-4f89-a016-02f215e930e1.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=secret%2F20230304%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230304T221406Z&X-Amz-Expires=3600&X-Amz-Signature=supersecret&X-Amz-SignedHeaders=host

REMARK:

3. Store value

Use a button to write the value to your database of choice (you can even iterate and send multiple attachments). Clear the form after storing the value(s).

4. (optional) Delete attachment from minio

(if you want to delete the row from your database of choice, you can delete the actual file using this method) I am using the budibase API from inside budibase (REST datasource).

- 4.1 get your api key from inside the builder

image

- 4.2 create a new REST query

image for the BASEURL you can use http://serverip:port or https://yourbudibase.com

- 4.3 add your budibase API key as a header

image

- 4.4 setup the POST body

image

NOTE: the value we need to use = bucketname/folder/filename, which happens to be the same value as 2.1

ksorgIN commented 1 year ago

supporting a blob type would be very useful. I use it in my current solution that is going away for our employee directory.

BlackSazha commented 1 year ago

+1

eizemazal commented 1 year ago

it will be possible to use the "S3 File Upload" component to upload files to the built in MinIO instance, or to some other S3 based environment

This is not true as of 2.9.30. I installed Budibase from DigitalOcean marketplace, and also added a space and a postgres cluster. The S3 upload component says it will not work with custom S3 endpoints, thus eliminating for me the possibility to use DO spaces and any external MinIO instances that I could roll out on my own on K8s or bare metal instead of DO space. This sounds strange to me, because I myself implemented S3 uploads to different environments, both to DO spaces and MinIO, using Javascript and Python. Even though there are differences in API (there are S3 bucket policies in DO those Minio does not support), these environments are very similar, and I do not understand, why you limit this component to Amazon S3.

I also did not find how to use Attachment control in my environment.

Do I understand it right that if I am using an external relational database (posgres or mysql) together with anything else than Amazon S3, I am out of luck with file uploads altogether?