Comments (8)
Then you will be covered 😄. I will definitely try to figure out workaround for arm issue anyways and make instructions in readme
from tds.
For now my workaround is to exclude the real field from the schema and using a virtual field filled with a fragment in the query:
query =
from p in Project,
select_merge: %{location: fragment("CAST(Location AS nvarchar(100))")}
Repo.one!(query)
or
query =
from p in Project,
select_merge: %{location: fragment("Location.STAsText()")}
Repo.one!(query)
from tds.
The more I look at it, the more I think it should be just ecto custom type.
Do we need structs or string is good enough?
from tds.
I think the first step should be to make TDS aware of the types so it will not error.
If you query directly the db with t-sql it return an Hex.
As far as I understand, I'm not a SQLServer expert, you use the included functions to decode them, as I did with the fragment, unless you are in c# land, then they are 'native'.
Ideally we would have all the types already decoded, maybe in WKT or WKB, to manipulate the values with the appropriate libraries.
Microsoft SQL Server CLR Types Serialization Formats
from tds.
I'm facing another limitation now, I moved all containers on my M1 Mac so I have to use the azure-sql-edge docker image.
azure-sql-edge is not complete and can't use the CLR functions like .STAsText() or cast to nvarchar, therefore the fragment doesn't work anymore.
This will not impact the production system but is not ideal from a dev POV, do you think we can at least find a way to get the binary value from the geography/geometry column?
To not crash Ecto during the queries.
from tds.
We are trying to make plan for binary format support, that should resolve STAsString issue, but if that is the case, Im not sure if you will be able to use other geometry::* functions.
Did you try to run other sqlerver image in amd64 emulated mode?
from tds.
We are trying to make plan for binary format support, that should resolve STAsString issue,
This is awesome!
but if that is the case, Im not sure if you will be able to use other geometry::* functions.
Why? You mean with the arm version?
I'm less than worried to no be able to use the geometry functions, I don't really need to query the database with geo* functions.
I need just the values of the geometries in WKT/WKB or in another standard format.
I can even try to decode them myself with a bit of help if I can get the binary.
We just have POINTs in that field, it should not be complex, right?
What I need is to extract some POINTs from this legacy DB to interact with the data in another new system.
The legacy system will go under a total rewrite anyway later this year and we will use Postgres.
Did you try to run other sqlserver image in amd64 emulated mode?
No, for now I tried just the arm one and disabled the problematic field,
I read this is a bit problematic under Monterey.
from tds.
@mjaric
Any progress on this?
The big rewrite got postponed so we are stuck with the legacy database,
meanwhile we are porting smaller pieces of our system to elixir and we need to
access one of the geography columns.
We can do it converting the geometry during the query with STAsText()
but I would like to explore the decoding of the geography data on the Elixir side.
Can you help me to get the raw binary from the database?
I'm hitting Unsupported Token code 0x3 in Token Stream
from tds.
Related Issues (20)
- Getting MatchError even when passing correct credential HOT 10
- Ecto.Adapters.SQL.query/4 does not set correct type for parameters. HOT 7
- Need help with output parameter - SQL Server 2016 HOT 2
- Federated Auth HOT 3
- Implicit conversion from data type varbinary to date is not allowed HOT 18
- Current Status of this project? HOT 19
- Pull ntlm_auth to master HOT 3
- Support for Table Value Parameters in Tds adapter HOT 3
- Casting to nvarchar(max) returns nil results. HOT 4
- TLS connection error with OTP 25 HOT 5
- Image type support? HOT 9
- FunctionClauseError following a connection redirect HOT 3
- Azure Sql Database error NXDOMAIN HOT 1
- Bureaucracy HOT 2
- Connect to SQL server over TCP HOT 4
- Azure Redirect TCP connection closes every 2 minutes HOT 5
- Error connecting to local MSSQL database
- TDS and query prefixes to access several databases inside MSSQL HOT 1
- Ecto queries timeout when using the Ecto.Adapters.Tds adapter to query 10000 rows with columns of floating point numbers HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tds.