-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V1.0.0 #64
Open
PM-Pepsico
wants to merge
33
commits into
master
Choose a base branch
from
v1.0.0
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
V1.0.0 #64
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This reconfigures most of our connection handling to follow the Ecto.Adapters.SQL.Connection behavior. This allows queries to be constructed using Ecto schemas and the Ecto.Query macros. An Ecto Repo for querying can now be created by defining a module like so: ``` defmodule MyApp.Repo do use Ecto.Repo, otp_app: :my_app, adapter: Snowflex.EctoAdapter end ``` Compatibility with previous versions of snowflake by adding an execute function to this Repo module which will use the new API and translate to results to how they were returned previously like so: ``` def execute(query, params \\ [], opts \\ []) do %Snowflex.Result{columns: columns, rows: rows} = __MODULE__.query!(query, params, opts) bin_headers = columns |> Enum.map(fn header -> header |> to_string() |> String.downcase() end) |> Enum.with_index() Enum.map(rows, fn row -> Enum.reduce(bin_headers, %{}, fn {col, index}, map -> data = row |> Enum.at(index) Map.put(map, col, data) end) end) end ```
We add a migration generator module which provides a macro to generate the migrations needed to test any Ecto Schema. This allows you to swap in another Ecto adapter for local testing without connecting to Snowflake. To use this you can bring the Snowflex.SQLiteTestRepo into your project and use it as you normally would for testing. You will need to drop and create the repo before starting the tests each time so the migrations can work from a blank slate. You will also need to run the generate_migrations macro in your test_helper files with a list of all the Ecto Schemas you wish to test.
The Erlang odbc api does not allow for params to be passed when using a cursor. Users can get around this limitation by passing arguments embedded as string directly in their query using the fragment function in Ecto.Query.API
ODBC requires unicode params to be sent as :sql_wvarchar and encoded as UTF-16. This sends all strings in this format by default to support unicode.
Because `nil` is technically an atom, we need to ensure that it gets encoded before we attempt to encode other atoms as `sql_varchars`. This commit moves the `nil` case clause to a more appropriate location.
If the auto_commit mode has been turned off we now send a rollback message to each process before a disconnect so ODBC can gracefully end the connection.
We weren't actually checking if the auto_commit mode was off, so we were never sending commit commands to odbc. This fixes the issue.
This enables a multi-statement query, e.g. "select 1; select 2".
Pinning sqlite3 to a specific version can break downstream applications in a way that is not strictly necessary.
This keeps the compiler happy if we're in a project or environment in which the user has chosen not to opt in to sqlite3 usage.
remove unused deps
These connection options are only needed when establishing a new connection and they are retrieved from config at that time. This ensures that sensitive information is not logged when a snowflex connection crashes. fixes DAPPS-2084
…tive-data-from-logs remove sensitive data from logs
- QueryExpr was replaced by LimitExpr in Ecto 3.10 - elixir-ecto/ecto@ab0771e#diff-f6fccb126b6a000082919ac48a91913684598c4a682e420bc4121c80b487c21cR2419
Handles instances where date may be wrapped in an additional call, such as `Ecto.Query.API.max/1`. Example: ``` from(s in MySchema, select_merge: %{my_date: max(s.my_date)}) |> MyRepo.all() ```
feat(ecto_adapter): cast maybe dates to date
In Ecto 3.11, adapters now handle decoding with nil values, originating from null values in records.
chore(ecto_adatper): Update decoding behavior in adapters for Ecto 3.11
…cations V1.0.0 fix logger deprecations
## Context ``` warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead │ 256 │ defp insert_all_value(_), do: '?' │ ~ │ └─ lib/snowflex/ecto/connection.ex:256:33 warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead │ 601 │ '?' │ ~ │ └─ lib/snowflex/ecto/connection.ex:601:5 ```
## Context ecto release v1.12.1 introduced a change to the way mappings were return for `Ecto.Enum.mappings/2`. We were relying on this mapping to convert Ecto.Enum to `:string` when creating the database columns. See elixir-ecto/ecto@21c6068#diff-025069044568b480ef6f86f025cb46a7064695e6df1e7008ede689e09a9c7836L317-R318 ## Decision To make this more future proof, use `Ecto.Type.type/1` to handle schema type to database type conversions.
chore: use Ecto.Type.type to determine db type
…ges-ecto-type Revert "Merge pull request #81"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This reconfigures most of our connection handling to follow the Ecto.Adapters.SQL.Connection behavior. This allows queries to be constructed using Ecto schemas and the Ecto.Query macros.
An Ecto Repo for querying can now be created by defining a module like so:
Compatibility with previous versions of snowflake is possible by adding an execute function to this Repo module which will use the new API and translate the results to how they were returned previously like so: