The next generation relational database.

Overview

Build Status Join GitHub discussions

What is EdgeDB?

EdgeDB is an open-source object-relational database built on top of PostgreSQL. The goal of EdgeDB is to empower its users to build safe and efficient software with less effort.

EdgeDB features:

  • strict, strongly typed schema;
  • powerful and expressive query language;
  • rich standard library;
  • built-in support for schema migrations;
  • native GraphQL support.

Check out the blog posts for more examples and the philosophy behind EdgeDB.

Modern Type-safe Schema

The data schema in EdgeDB is a clean high-level representation of a conceptual data model:

type User {
    required property name -> str;
}

type Person {
    required property first_name -> str;
    required property last_name -> str;
}

type Review {
    required property body -> str;
    required property rating -> int64 {
        constraint min_value(0);
        constraint max_value(5);
    }

    required link author -> User;
    required link movie -> Movie;

    required property creation_time -> local_datetime;
}

type Movie {
    required property title -> str;
    required property year -> int64;
    required property description -> str;

    multi link directors -> Person;
    multi link cast -> Person;

    property avg_rating := math::mean(.<movie[IS Review].rating);
}

EdgeDB has a rich library of datatypes and functions.

EdgeQL

EdgeQL is the query language of EdgeDB. It is efficient, intuitive, and easy to learn.

EdgeQL supports fetching object hierarchies with arbitrary level of nesting, filtering, sorting and aggregation:

SELECT User {
    id,
    name,
    image,
    latest_reviews := (
        WITH UserReviews := User.<author
        SELECT UserReviews {
            id,
            body,
            rating,
            movie: {
                id,
                title,
                avg_rating,
            }
        }
        ORDER BY .creation_time DESC
        LIMIT 10
    )
}
FILTER .id = <uuid>$id

Status

EdgeDB is currently in alpha. See our Issues for a list of features planned or in development.

Getting Started

Please refer to the Tutorial section of the documentation on how to install and run EdgeDB.

Documentation

The EdgeDB documentation can be found at edgedb.com/docs.

Building From Source

Please follow the instructions outlined in the documentation.

License

The code in this repository is developed and distributed under the Apache 2.0 license. See LICENSE for details.

Comments
  • restore is not the inverse of dump

    restore is not the inverse of dump

    • EdgeDB Version: Docker image: edgedb/edgedb:1-beta1
    • OS Version:

    Steps to Reproduce:

    1. edgedb dump backup --all --format=dir
    2. edgedb restore -v --allow-non-empty --all backup

    Result:

    edgedb error: error applying init file "backup/init.edgeql": failed statement "# DESCRIBE ROLES\nCREATE SUPERUSER ROLE `myuser` { SET password_hash := \'SCRAM-SHA-256$4096:xxxxxxxxxxx=\'};": ERROR: SchemaError: role 'myuser' is already present in the schema
    

    I would expect that if I put --allow-non-empty, especially with --all, I would be allowed to do such a thing. Is it as intended?

    I feel like there should be a way to cleanly "start fresh from a full backup".

    opened by Mulugruntz 21
  • Consider renaming local_datetime back to naive_datetime

    Consider renaming local_datetime back to naive_datetime

    A few questions regarding our handling of date/time came up in our internal Slack recently:

    • I would like UTC timestamp without any timezone; should use local_datetime?
    • Or should I use datetime and expect nobody messes up with timezone?
    • If I need a timestamp, like expiration time of something. Should this be a timezone-aware datetime?
    • Should I assume it's UTC when returned from database or should I enforce (convert) timezone when formatting?
    • I would expect local_datetime to be timezone-aware.

    Since this is quite a complex topic I'd like to start by explaining how EdgeDB works with date/time compared to Postgres.

    EdgeDB

    In EdgeDB there is a timezone aware type std::datetime and a naive date/time type std::local_datetime.

    std::datetime is stored internally in UTC and binary-wise it's identical to std::local_datetime. The fact that std::datetime values are time zone aware is encoded into their type. E.g. when a user receives a std::datetime value they:

    • Know that they are dealing with a time zone aware date/time.

    • If they want to render this date time to string in their front-end code they have to specify the target time zone. E.g. to render a std::datetime value to a string via EdgeQL the user would use std::to_str function that would require the user to pass the timezone they want the time to be rendered in. Usually that timezone would be the timezone of the current user that's interacting with the date.

    • EdgeQL is strict w.r.t. separating std::datetime from std::local_datetime. For instance it's not possible to subtract std::datetime from std::local_datetime — the operation is undefined. Subtracting std::datetime from std::datetime or std::local_datetime from std::local_datetime is allowed and would produce a std::duration.

    • When a user submits a std::datetime value to the database it's their responsibility to let the DB know how to convert it to UTC. There's no magical config setting (unlike in Postgres) that would automatically let naive date/time be converted to time zone aware date/time.

    Here's a couple of use cases to understand the naming motivation:

    • datetime is a globally recognizable point in time. Example: space shuttle launch time; file creation time; when a log or audit record was created; precise moment of when a financial transaction has been committed.

    • local_datetime is something that makes sense regardless of time zone. Examples: milk expiry date; alarm clock wake up time; arrival time on air/train tickets is always in local time of the destination.

    💡 Maybe we should add this ^^ to the docs.

    PostgreSQL

    Quoting Postgres documentation:

    PostgreSQL endeavors to be compatible with the SQL standard definitions for typical usage. However, the SQL standard has an odd mix of date and time types and capabilities.

    There are two types in Postgres that are interesting for us in the context of this discussion: timestamp and timestamptz (it's an alias for SQL's timestamp with time zone):

    • timestamp is used to store naive date/time, e.g. when time zones aren't applicable or not known.

    • timestamptz is used to store time zone aware date/time. It is stored on the server in UTC. As in EdgeDB, in Postgres, they are identical values when stored on the disk, meaning that the difference between the two is purely their type id (OID).

    So far so good, Postgres date/time handling looks just like EdgeDB. The key difference is that in Postgres there's a server config setting TimeZone that is used to automatically convert time zone aware and naive date/time to each other. Examples:

    • if a user submits a text date/time without timezone to timezonetz cast Postgres will use the config setting and convert it silently. When the user queries the submitted value back, it might be different from what was submitted because of that transformation, leaving the user confused.

    • if a user subtracts a timezone value from a timezonetz value, Postgres will use the config setting to silently convert timezone to timezonetz. Again, this can lead to confusion, as the result would look totally different from what a naive user assumed.

    EdgeDB does not have automatic conversion. To submit a std::datetime value a time zone must be specified along with it. Implicit mixing of time zone aware and naive date/time values is prohibited.

    Q&A

    • I would like UTC timestamp without any timezone; should use local_datetime?

    You should use std::datetime. Just point out to EdgeDB that it's already in UTC.

    • Or should I use datetime and expect nobody messes up with timezone?

    You should indeed use std::datetime. You should make sure that your frontend code renders your date/time values either in: local user's time zone; or in UTC. The format is up to you and your UI requirements, EdgeDB does not care.

    • If I need a timestamp, like expiration time of something. Should this be a timezone-aware datetime?

    Depends. If it's the expiration time of a carton of milk I'd say you should use std::local_datetime. If it's the expiration time of evaluation period of your SaaS offering it should be std::datetime -- that way the user will know the precise time no matter where they currently are, in London or in New York.

    • Should I assume it's UTC when returned from database or should I enforce (convert) timezone when formatting?

    For std::datetime — yes!

    For std::local_datetime — it can be whatever, the database does not know. Only the developer knows and can use it correspondingly.

    The rule of thumb here is that if the date/time value is meant to be rendered using different time/zones it should always be std::datetime.

    • I would expect local_datetime to be timezone-aware.

    Yes, I can see where the confusion is coming from. See the💡-paragraph section above for our motivation of naming it that way.


    We might want to consider renaming local_datetime back to naive_datetime. At the very least our documentation must be improved.

    documentation 
    opened by 1st1 20
  • Add `module` block to SDL

    Add `module` block to SDL

    The current version of SDL and migrations does not allow expressing the migration of interdependent modules because a single SDL blob is only supposed to reference one module. The solution to this is to force SDL to express the entire user-schema in the context of migration. This means that a single SDL block must denote unambiguously which modules the various entities belong to. There are two mechanisms proposed for that:

    1. Fully-qualified names for all entities (except ones belonging to std, since that's always built-in in all contexts).
    2. A special module <name> { ... } block. All inner SDL inside this block is understood to have the default module <name>. It is possible to have multiple module blocks with the same name in a single SDL document.

    The total list of modules in the schema is inferred from module block names and from fully-qualified names.

    Example of SDL using module blocks:

    module default {
       # the default module here is "default"
       type Foo {
          # the module "std" is also part of the default name 
          # resolution as usual
          property name -> str;
          link bar -> other_mod::Bar;
       }
    }
    
    module other_mod {
       # the default module here is "other_mod"
       type Bar {
          link bar -> Bar;
          link foo -> default::Foo;
       }
    }
    

    And the same schema expressed using only fully-qualified names SDL:

    # only the "std" module can be omitted here, all other 
    # names have to be fully-qualified, even "defaut"
    type default::Foo {
       property name -> str;
       link bar -> other_mod::Bar;
    }
    
    type other_mod::Bar {
       link bar -> other_mod::Bar;
       link foo -> default::Foo;
    }
    

    The following schemas are also equivalent:

    # Multiple module blocks with the same name
    module default {
       type Foo;
    }
    
    module other_mod {
       type Bar;
    }
    
    module default {
       type Foo2;
    }
    
    # Each module block has a unique name
    module default {
       type Foo;
       type Foo2;
    }
    
    module other_mod {
       type Bar;
    }
    
    # Mix of fully-qualified names and module blocks
    type default::Foo;
    
    module other_mod {
       type Bar;
    }
    
    module default {
       type Foo2;
    }
    
    documentation edgeql high priority 
    opened by vpetrovykh 19
  • Edgedb schema import/export

    Edgedb schema import/export

    Is it possible to load(import migrations from file) or to save(export) migrations to .esdl file? As far as I seen, not yet. I want to implement this feature, but I need to discuss how would it work first. My idea is to integrate it to cli like so: edgedb schema export file_name.esdl to export current database schema to file edgedb schema import file_name.esdl to import to database Where importing would just run CREATE MIGRATION {file_name} TO {file_contents} And exporting would save all the schema? From what I can see, there is only CREATE MIGRATION and GET MIGRATION, is it possible to get current schema or list of migrations via edgeql?

    opened by MrNaif2018 18
  • Disallow DELETE and UPDATE in many cases without FILTER

    Disallow DELETE and UPDATE in many cases without FILTER

    This patch errs on the side of disallowing, since it is pretty easy to workaround.

    We allow DML when the source is filtered, comes from a query that is not a set reference, when it is a FOR iterator, and when it is the set being inserted in the ELSE clause of INSERT ... ELSE. (FOR is allowed because the meaning seems to clearly imply applying to everything ...and because it made the implementation easy.)

    Most of the test cases for things we allow are existing ones.

    I can follow up with a documentation update if there is agreement on this one.

    Closes #1742.

    opened by msullivan 16
  • Naming conventions for scalars and object types.

    Naming conventions for scalars and object types.

    Currently there's a convention in EdgeDB to name scalar types using lower_case with an added _t at the end. Object types are named using CamelCase.

    The _t is meant to easily distinguish scalar type names and other lower-case names like functions and links. Abstract links are especially important here since they exist in the same namespace as the scalar types and can't use the same name. Although the problem of clashing names is a real one and needs to be solved, adding _t is somewhat awkward as a solution. In the general case of all scalar types it may be that "give better names" is the only generic reasonable advice.

    However, there's a subset of scalar types that may have a different solution - enums. We could have a convention that the enum type names should be ALLCAPS to kind of remind what these types are. Using ALLCAPS for special constants is common practice in some programming languages and enums are conceptually similar to specialized constants.

    Object type names should probably keep using CamelCase.

    Whatever convention we agree on, should be reflected in our own built-in libraries. Incidentally, we still have some remains of "old-style enums" that emulated enum behavior by using a one_of constraint. The good news is that we only have things that are functionally enums that follow the _t scalar naming, other built-in scalars just have plain readable names.

    documentation usability high priority 
    opened by vpetrovykh 16
  • SELECT Object IF EXISTS Object ELSE INSERT

    SELECT Object IF EXISTS Object ELSE INSERT

    Hi, I tried to use the IF...ELSE and EXISTS clauses in order to construct a query that either selects an item if it exists or else inserts it. So since I can do the following:

    SELECT 1 IF EXISTS (SELECT Person FILTER .name = 'Ryan Gosling') 
    ....... ELSE (SELECT 0);
    

    ...I tried to do

    SELECT Person FILTER .name = 'Ryan Gosling' 
    ....... IF EXISTS (SELECT Person FILTER .name = 'Ryan Gosling') 
    ....... ELSE (SELECT <int64>{});
    

    However I get the error: QueryError: operator 'std::IF' cannot be applied to operands of type 'std::bool', 'std::bool', 'std::int64'

    Am I making some syntax error or is this kind of selection not allowed? I assumed it would work because the documentation on IF states anytype as the left assignment, but I have not been able to figure out how to make it work with my schema types.

    Thank you very much for your help.

    opened by kfrp 15
  • Inconsistency with volatile calls

    Inconsistency with volatile calls

    1. FOR x IN {1, 2, 3} UNION (x, random()); returns identical values
    2. FOR x IN {1, 2, 3} UNION (SELECT (x, random())); returns different values
    3. SELECT (FOR x IN {1, 2, 3} UNION (SELECT (x, random()))); returns identical values (!)

    I /think/ that all 3 ought to return different values but 2 and 3 definitely should do the same thing.

    opened by msullivan 14
  • Require a FILTER on DELETE and UPDATE?

    Require a FILTER on DELETE and UPDATE?

    There was some discussion earlier about requiring FILTER on DELETE and UPDATE statements, to help prevent mishaps. FILTER true could be used when operating on everything is actually desired.

    (Relevant: https://www.youtube.com/watch?v=i_cVJgIz_Cs)

    opened by msullivan 14
  • Consider removing `local_datetime`

    Consider removing `local_datetime`

    Idea

    Make a single datatype for a timestamp which is basically UTC datetime.

    Motivation

    1. There are very little use cases (if any) of the type
    2. It's a source of lots of errors
    3. If you really want it, think twice and use two fields for date and time (i.e. date when alarm first started and time when it should ring for a recurring alarm, instead of cobining the two)

    What other databases are doing?

    Terms:

    • naive -- timestamp without timezone specified (for example 2019-11-25 22:10:42 if written as string)
    • unix timestamp -- specific representation of datetime in seconds since the unix epoch (epoch is in UTC so the whole value doesn't depend on the time zone)
    • UTC-normalized timestamp -- means datetime stored as UTC internally being it unix timestamp or timestamp at UTC

    Databases:

    • PostgreSQL has TIMESTAMP which is documented to be UTC but accepts a naive timestamp as an input, so easy to misuse. And TIMESTAMPTZ which accepts any timezone offset as input and converts to UTC timestamp internally. Converts to client session time on output.
    • MySQL has TIMESTAMP which accepts a naive timestamp in local time and does autoconversion to UTC for storage. DATETIME is just a naive timestamp without conversion
    • VoltDB uses UTC-normalized TIMESTAMP. As long as I understand it has Java API and it's hard to mess with timezones (because it's converted from java.date.Date that is basically a unix timestamp)
    • MongoDB has UTC-normalized timestamp named Date (as far as I understand when converting to/from a string they only accept Z-suffixed format 2019-11-25T22:10:42Z). Name probably inherits JavaScript type name
    • Clickhouse use naive format that is converted to/from local time, named DateTime (basically like TIMESTAMP in mysql)
    • FoundationDB (in document layer) basically supports MongoDB semantics
    • RethinkDB actually store timestamp + timezone, named time
    • Cassandra uses UTC-normalized timestamp and auto-converts to timezone in some clients
    • Redis has no datatype for storing datetimes but uses unix timestamp (in seconds) in commands like EXPIREAT

    Conclusions:

    1. Except in PostgreSQL and MySQL every database has a single datetime type (most of them don't have separate date or time, though)
    2. Whereas PostgreSQL and MySQL looks like were trying to fix a mistake, that's why they added a type, not because two types needed
    3. Timestamp means different things in different databases so it's okay to give it our own meaning (i.e. rename datetime -> timestamp)

    Update: added cassandra

    opened by tailhook 14
  • Trying to update listen_addresses triggers ISE: address already in use

    Trying to update listen_addresses triggers ISE: address already in use

    • EdgeDB Version: 1.0-beta.2+ga7130d5c7.cv202104290000
    • OS Version: Ubuntu 20.04

    Steps to Reproduce:

    1. create server instance
    2. edgedb -I SERVER_NAME configure set listen_addresses 127.0.0.1 ::1 0.0.0.0
    
    edgedb error: ERROR: InternalServerError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 10700): address already in use
      Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
      Server traceback:
          Traceback (most recent call last):
            File "edb/server/protocol/binary.pyx", line 1694, in edb.server.protocol.binary.EdgeConnection.main
            File "edb/server/protocol/binary.pyx", line 950, in simple_query
            File "edb/server/protocol/binary.pyx", line 1045, in _simple_query
            File "edb/server/protocol/binary.pyx", line 1002, in edb.server.protocol.binary.EdgeConnection._simple_query
            File "edb/server/protocol/binary.pyx", line 1405, in _execute_system_config
            File "edb/server/dbview/dbview.pyx", line 515, in apply_config_ops
            File "edb/server/dbview/dbview.pyx", line 649, in apply_system_config_op
            File "/usr/lib/x86_64-linux-gnu/edgedb-server-1-beta2/lib/python3.9/site-packages/edb/server/server.py", line 629, in _on_system_config_set
              await self._restart_servers_new_addr(value, self._listen_port)
            File "/usr/lib/x86_64-linux-gnu/edgedb-server-1-beta2/lib/python3.9/site-packages/edb/server/server.py", line 573, in _restart_servers_new_addr
              self._servers, _ = await self._start_servers(nethost, netport)
            File "/usr/lib/x86_64-linux-gnu/edgedb-server-1-beta2/lib/python3.9/site-packages/edb/server/server.py", line 786, in _start_servers
              tcp_srv = await self._loop.create_server(
            File "uvloop/loop.pyx", line 1768, in create_server
          OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 10700): address already in use
    

    Despite the error, value is changed in config:

    edgedb> SELECT cfg::DatabaseConfig.listen_addresses;
    {'0.0.0.0', '127.0.0.1', '::1'}
    
    bug 
    opened by Fogapod 13
  • `edgedb instance create --default-database` is broken in 2.7

    `edgedb instance create --default-database` is broken in 2.7

    Full log:

    ~/d/ttt » edgedb instance create --default-database=aaa
    [2022-11-19T15:29:53Z WARN  edgedb::version_check] Newer version of edgedb tool exists 2.2.0+35980b5 (current 2.1.0+527e309). To upgrade run `edgedb cli upgrade`
    Specify a name for the new instance:
    > aaa
    Version 2.7+a86e274 is already installed
    Initializing EdgeDB instance...
    [edgedb] ---- Exception occurred: cannot execute CREATE DATABASE with other commands in one block ----
    [edgedb]
    [edgedb] 1. edb.errors.QueryError: cannot execute CREATE DATABASE with other commands in one block
    [edgedb]
    [edgedb] ---- Source Context ----
    [edgedb]
    [edgedb]     <string>, line 1, in <string>
    [edgedb]         |             };
    [edgedb]         > CREATE DATABASE aaa;
    [edgedb]           ^
    [edgedb]         |             ALTER ROLE edgedb {
    [edgedb]
    [edgedb]
    [edgedb] ---- Traceback ----
    [edgedb]
    [edgedb]     /Users/yury/Library/Application Support/edgedb/portable/2.7/bin/edgedb-server.py, line 7, in <module>
    [edgedb]         > sys.exit(main())
    [edgedb]     /Users/yury/Library/Application Support/edgedb/portable/2.7/lib/python3.10/site-packages/click/core.py, line 829, in __call__
    [edgedb]         > return self.main(*args, **kwargs)
    [edgedb]     /Users/yury/Library/Application Support/edgedb/portable/2.7/lib/python3.10/site-packages/click/core.py, line 782, in main
    [edgedb]         > rv = self.invoke(ctx)
    [edgedb]     /Users/yury/Library/Application Support/edgedb/portable/2.7/lib/python3.10/site-packages/click/core.py, line 1236, in invoke
    [edgedb]         > return Command.invoke(self, ctx)
    [edgedb]     /Users/yury/Library/Application Support/edgedb/portable/2.7/lib/python3.10/site-packages/click/core.py, line 1066, in invoke
    [edgedb]         > return ctx.invoke(self.callback, **ctx.params)
    [edgedb]     /Users/yury/Library/Application Support/edgedb/portable/2.7/lib/python3.10/site-packages/click/core.py, line 610, in invoke
    [edgedb]         > return callback(*args, **kwargs)
    [edgedb]     /Users/yury/Library/Application Support/edgedb/portable/2.7/lib/python3.10/site-packages/click/decorators.py, line 21, in new_func
    [edgedb]         > return f(get_current_context(), *args, **kwargs)
    [edgedb]     /Users/yury/Library/Application Support/edgedb/portable/2.7/lib/python3.10/site-packages/edb/server/main.py, line 710, in main
    [edgedb]         > server_main(**kwargs)
    [edgedb]     /Users/yury/Library/Application Support/edgedb/portable/2.7/lib/python3.10/site-packages/edb/server/main.py, line 691, in server_main
    [edgedb]         > asyncio.run(run_server(server_args))
    [edgedb]     /Users/yury/Library/Application Support/edgedb/portable/2.7/lib/python3.10/asyncio/runners.py, line 44, in run
    [edgedb]         > return loop.run_until_complete(main)
    [edgedb]     uvloop/loop.pyx, line 1517, in uvloop.loop.Loop.run_until_complete
    [edgedb]
    [edgedb]     /Users/yury/Library/Application Support/edgedb/portable/2.7/lib/python3.10/site-packages/edb/server/main.py, line 617, in run_server
    [edgedb]         > await _run_server(
    [edgedb]     /Users/yury/Library/Application Support/edgedb/portable/2.7/lib/python3.10/site-packages/edb/server/main.py, line 236, in _run_server
    [edgedb]         > await sc.wait_for(ss.run_startup_script_and_exit())
    [edgedb]     /Users/yury/Library/Application Support/edgedb/portable/2.7/lib/python3.10/site-packages/edb/common/signalctl.py, line 167, in wait_for
    [edgedb]         > return fut.result()
    [edgedb]     /Users/yury/Library/Application Support/edgedb/portable/2.7/lib/python3.10/site-packages/edb/server/server.py, line 1641, in run_startup_script_and_exit
    [edgedb]         > await binary.run_script(
    [edgedb]     edb/server/protocol/binary.pyx, line 2330, in run_script
    [edgedb]
    [edgedb]     edb/server/dbview/dbview.pyx, line 979, in parse
    [edgedb]
    [edgedb]     edb/server/dbview/dbview.pyx, line 966, in edb.server.dbview.dbview.DatabaseConnectionView.parse
    [edgedb]
    [edgedb]     edb/server/dbview/dbview.pyx, line 1044, in _compile
    [edgedb]
    [edgedb]     /Users/yury/Library/Application Support/edgedb/portable/2.7/lib/python3.10/site-packages/edb/server/compiler_pool/pool.py, line 392, in compile
    [edgedb]         > result = await worker.call(
    [edgedb]     /Users/yury/Library/Application Support/edgedb/portable/2.7/lib/python3.10/site-packages/edb/server/compiler_pool/pool.py, line 124, in call
    [edgedb]         > raise exc
    [edgedb]
    [edgedb] ---- Details ----
    [edgedb]
    [edgedb]
    [edgedb] edb.errors.QueryError: cannot execute CREATE DATABASE with other commands in one block
    edgedb error: cannot bootstrap EdgeDB instance: bootstrap failed: exit status: 1 (command-line: "/Users/yury/Library/Application Support/edgedb/portable/2.7/bin/edgedb-server" "--bootstrap-only" "--data-dir" "/Users/yury/Library/Application Support/edgedb/data/.~aaa.tmp" "--runstate-dir" "/Users/yury/Library/Caches/edgedb/run/aaa" "--tls-cert-mode=generate_self_signed" "--jose-key-mode=generate" "--bootstrap-command" "CREATE DATABASE aaa;\n            ALTER ROLE edgedb {\n                SET password_hash := \"SCRAM-SHA-256$4096:sSyA2e6Wzso8tR26QUEHiw==$r0RQnmgH7Y91AJl8Qiutmv/2P0oVeNTaHruc9zQuITo=:bbpiQws6aUKQ6WaumXEA/KY6Wdd/5B0u6RMFy1Iha1E=\";\n            };\n            ")
    

    cc @elprans @msullivan

    opened by 1st1 0
  • Sporadic connection issues on creation and restore of a new database

    Sporadic connection issues on creation and restore of a new database

    • EdgeDB Version: 2.6
    • OS Version: (official EdgeDB Docker Image, running in AWS ECS container)

    Steps to Reproduce:

    1. have 2 EdgeDB ECS Fargate container services running, pointing to the same RDS postgres backend, with an existing "main" database
    2. create a new test env DB (edgedb database create {new db})
    3. pull a db dump from the main db and restore it to the new db (edgedb --dsn "{dsn}/{main db}" dump db.dump && edgdb --dsn "{dsn}/{new db}" restore db.dump)
    4. run a migration to make sure any new migrations in the test env code are laid on top of the existing restore schema (edgedb migration apply)

    Expected: The new test database is now fully set up, with the full data and schema from the main db along with any new migrations in the test code

    Actual: sometimes this works just fine. Sometimes I receive one of two errors, with no real consistency I've observed for why it'd be one or the other. From the CLI command, I'll either see a database '{test db}' does not accept connections when running the restore or the migration... or a specified migration parent does not exist when running the migration (which would suggest to me that the restore didn't fully succeed).

    Additional notes:

    • Checking the EdgeDB service logs, the does not accept connections error on the CLI correlates to this in the service logs (db name replaced for obscurity purposes):
    | 1668786725456 | ---- Exception occurred: database '{name of database}' does not accept connections ----                                    |
    | 1668786725456 | 1. edb.errors.AccessError: database '{name of database}' does not accept connections                                       |
    | 1668786725456 | ---- Traceback ----                                                                                                        |
    | 1668786725456 |     edb/server/protocol/binary.pyx, line 1310, in edb.server.protocol.binary.EdgeConnection.main                           |
    | 1668786725456 |                                                                                                                            |
    | 1668786725456 |     edb/server/protocol/binary.pyx, line 476, in auth                                                                      |
    | 1668786725456 |                                                                                                                            |
    | 1668786725456 | ---- Details ----                                                                                                          |
    | 1668786725456 | edb.errors.AccessError: database '{name of database}' does not accept connections                                          |
    | 1668786725456 | ERROR 7 2022-11-18T15:52:05.455 asyncio: unhandled error in edgedb protocol while accepting new connection                 |
    | 1668786725456 | protocol: <edb.server.protocol.binary.EdgeConnectionBackwardsCompatible object at 0x7fee39afae60>                          |
    | 1668786725456 | task: <Task pending name='Task-583093' coro=<EdgeConnection.main() running> cb=[TaskGroup._on_task_done(), set.discard()]> |
    | 1668786725456 | transport: None                                                                                                            |
    | 1668786745611 | ---- Exception occurred: database '{name of database}' does not accept connections ----                                    |
    | 1668786745611 | 1. edb.errors.AccessError: database '{name of database}' does not accept connections                                       |
    | 1668786745611 | ---- Traceback ----                                                                                                        |
    | 1668786745611 |     edb/server/protocol/binary.pyx, line 1310, in edb.server.protocol.binary.EdgeConnection.main                           |
    | 1668786745611 |                                                                                                                            |
    | 1668786745611 |     edb/server/protocol/binary.pyx, line 476, in auth                                                                      |
    | 1668786745611 |                                                                                                                            |
    | 1668786745611 | ---- Details ----                                                                                                          |
    | 1668786745611 | edb.errors.AccessError: database '{name of database}' does not accept connections                                          |
    | 1668786745611 | ERROR 7 2022-11-18T15:52:25.611 asyncio: unhandled error in edgedb protocol while accepting new connection                 |
    | 1668786745611 | protocol: <edb.server.protocol.binary.EdgeConnectionBackwardsCompatible object at 0x7fee39afae60>                          |
    | 1668786745611 | task: <Task pending name='Task-583114' coro=<EdgeConnection.main() running> cb=[TaskGroup._on_task_done(), set.discard()]> |
    | 1668786745611 | transport: None                                                                                                            |
    
    • Worth noting that the entire create/dump/restore/migrate is handled by a script we built so the timing is pretty rapid between steps. To attempt to combat this, just in case there was a problem of readiness immediately after the create or the restore, I have added a wait helper that pauses a a minimum of 30 seconds, then attempts a simple select count(Object) query against the test DB every 20 seconds until successful, before it allows the script to continue to the next step. So if this is a race condition it's a fairly large one.
    opened by bradsbrown 0
  • Connection refused when generating Query Builder

    Connection refused when generating Query Builder

    • EdgeDB Version: 2.6+ba1661b
    • OS Version: Windows 11

    Steps to Reproduce:

    1. Create new edgedb instance via project init
    2. Run deno run --allow-all --unstable https://deno.land/x/edgedb/generate.ts edgeql-js, as directed in the docs
    3. Throws network error:
    Generating query builder...
    Detected tsconfig.json, generating TypeScript files.
       To override this, use the --target flag.
       Run `npx @edgedb/generate --help` for full options.
    Introspecting database schema...
    A client connection error occurred; reconnecting because of "waitUntilAvailable=30000". ClientConnectionClosedError: network error: ConnectionRefused: No connection could be made because the target machine actively refused it. (os error 10061)
        at RawConnection._onError (https://deno.land/x/[email protected]/_src/rawConn.ts:157:20)
        at TLSSocket.emit (https://deno.land/[email protected]/node/_events.mjs:379:28)
        at https://deno.land/x/[email protected]/_src/adapter.deno.ts:299:16
    

    Seems to also be an issue using npx/pnpx. I can connect to the instance using the command line and web UI just fine. Starting the instance in the --foreground does not emit any ERROR level logging output.

    opened by jeremyjacob 2
  • Migrations fail when abstract properties are referenced in globals

    Migrations fail when abstract properties are referenced in globals

    • EdgeDB Version: 2.6
    • OS Version: macOS 13.0

    Steps to Reproduce:

    1. Create the schema below
    2. Run edgedb migration create

    Expected behavior: Migration should run successfully. Actual behavior: This produces the error error: object type 'default::Role' has no link or property 'slug'

    Schema:

    module default {
      global current_user_id -> uuid;
      global current_user := (
        select User filter .id = global current_user_id
      );
      global current_user_role := (
        (global current_user).role.slug
      );
    
      abstract type WithSlug {
        property slug -> str
      }
    
      type Role extending WithSlug {
        property description -> str
      }
    
      type User {
        required link role -> Role;
      }
    }
    
    opened by fritzblue 0
  • on_demand compiler pool doesn't seem to scale up properly

    on_demand compiler pool doesn't seem to scale up properly

    1. Run edb server --compiler-pool-mode=on_demand --compiler-pool-size=16
    2. Run edb cli migration create on a big schema that will take a while; I used the one from https://github.com/edgedb/edgedb/issues/4677
    3. Try running select 1 another cli.

    It will hang for a long time. (It might sneak in somewhere in the middle of the migration, which is multiple commands.)

    on_demand is the default for dev mode, so I was confused for a while. This reproduces without any compiler flags to edb server but I wanted to be explicit

    server 
    opened by msullivan 1
Releases(v2.6)
  • v2.6(Nov 5, 2022)

    The sixth bugfix release of the 2.x series. All users of 2.x are encouraged to upgrade using edgedb project upgrade --to-latest or edgedb instance upgrade <instance_name> --to-latest for instances that are not linked to a project.

    See the changelog here.

    Source code(tar.gz)
    Source code(zip)
  • v2.1(Aug 8, 2022)

    The first bugfix release of the 2.x series. All users of 2.x are encouraged to upgrade local instances using edgedb project upgrade --to-latest.

    v2.1

    • #4182 Fix global defaults with nontrivial computation
    • #4183 Fix migration that removes policy using clause
    • #4185 Support ELSE-less UNLESS CONFLICT on explicit id INSERT
    • #4187 Don't create constraints on derived views when adding a pointer to a type
    • #4188 Fix a bunch of missing source contexts in declarative
    • #4193 Fix an ISE when a computed link is directly a property reference
    • #4194 Fix an ISE when using an empty shape in some contexts
    • #4195 Fix a number of error messages involving collection types in schemas
    • #4196 Avoid doing semi-joins after a sequence of single links
    • #4207 Make range() properly strict in its non-optional arguments
    • #4189 Allow multiple FDs per socket in activation
    • #4197 Add SCRAM authentication over HTTP
    • #4214 Always arm auto-shutdown timer when it's greater than zero
    • #4217 Fix json -> array cast of '[]'

    Full Changelog: https://github.com/edgedb/edgedb/compare/v2.0...v2.1

    Source code(tar.gz)
    Source code(zip)
  • v2.0(Jul 29, 2022)

    V2_comp

    This is a major version release of EdgeDB. The changelog is rather extensive and can be found here: https://www.edgedb.com/docs/changelog/2_x

    See also the announcement blog post: https://www.edgedb.com/blog/edgedb-2-0

    Source code(tar.gz)
    Source code(zip)
  • v1.4(May 16, 2022)

    The fourth bugfix release of the 1.x series. All users of 1.x are encouraged to upgrade using edgedb project upgrade --to-latest or edgedb instance upgrade <instance_name> --to-latest for instances that are not linked to a project.

    Changes

    • Avoid unnecessary updates to parent views and triggers (#3771) (by @msullivan in 5fb344f0)

    • Drop broken special case for nested insert FOR (#3797) (by @msullivan in fb59493e)

    • Fix IN array_unpack for bigints (#3820) (by @msullivan in a39d5848)

    • Put more parens around index expressions in generated DDL (#3822) (by @msullivan in a5310dfe)

    • Fix a weird computable/alias interaction (#3828) (by @msullivan in d90652f8)

    • Support linkprops on backlinks (#3841) (by @msullivan in f06bec50)

    • Fix generation of dummy_pathid in nonconflict ctes (#3848) (by @msullivan in 5248eb98)

    • Always correctly handle variadic arguments when producing AST from migrations (#3855) (by @msullivan in 3fb2efa7)

    Source code(tar.gz)
    Source code(zip)
  • v1.3(Apr 19, 2022)

  • v1.2(Mar 21, 2022)

  • v1.1(Mar 4, 2022)

  • v1.0(Feb 10, 2022)

  • v1.0a4(Jul 16, 2020)

  • v1.0a3(Jun 23, 2020)

  • v1.0a2(Jan 29, 2020)

Owner
EdgeDB
The next generation relational database.
EdgeDB
Pytorch implementation of "A simple neural network module for relational reasoning" (Relational Networks)

Pytorch implementation of Relational Networks - A simple neural network module for relational reasoning Implemented & tested on Sort-of-CLEVR task. So

Kim Heecheol 797 Nov 15, 2022
NExT-QA: Next Phase of Question-Answering to Explaining Temporal Actions (CVPR2021)

NExT-QA We reproduce some SOTA VideoQA methods to provide benchmark results for our NExT-QA dataset accepted to CVPR2021 (with 1 'Strong Accept' and 2

Junbin Xiao 47 Nov 1, 2022
NExT-Ford-aula4 - NExT Ford aula4

Questão 1: vocês deveram fazer o passo a passo de como ficará as pilhas(Stack) e

Gerson 1 Jan 6, 2022
A Relational Database Management System for a miniature version of Twitter written in MySQL with CLI in python.

Mini-Twitter-Database This was done as a database design course project at Amirkabir university of technology. This is a relational database managemen

Ali 11 Jun 12, 2022
A next generation HTTP client for Python. 🦋

HTTPX - A next-generation HTTP client for Python. HTTPX is a fully featured HTTP client for Python 3, which provides sync and async APIs, and support

Encode 9.7k Nov 23, 2022
Detectron2 is FAIR's next-generation platform for object detection and segmentation.

Detectron2 is Facebook AI Research's next generation software system that implements state-of-the-art object detection algorithms. It is a ground-up r

Facebook Research 22.9k Nov 18, 2022
To be a next-generation DL-based phenotype prediction from genome mutations.

Sequence -----------+--> 3D_structure --> 3D_module --+ +--> ? | |

Eric Alcaide 18 Jan 11, 2022
The next generation Canto RSS daemon

Canto Daemon This is the RSS backend for Canto clients. Canto-curses is the default client at: http://github.com/themoken/canto-curses Requirements De

Jack Miller 154 Nov 2, 2022
OpenMMLab's Next Generation Video Understanding Toolbox and Benchmark

Introduction English | 简体中文 MMAction2 is an open-source toolbox for video understanding based on PyTorch. It is a part of the OpenMMLab project. The m

OpenMMLab 2.5k Nov 21, 2022
Raganarok X: Next Generation Data Dump

Raganarok X Data Dump Raganarok X: Next Generation Data Dump More interesting Files File Name Contains en_langs All the variables you need in English

null 14 Jul 15, 2022
Code for the paper "Next Generation Reservoir Computing"

Next Generation Reservoir Computing This is the code for the results and figures in our paper "Next Generation Reservoir Computing". They are written

OSU QuantInfo Lab 103 Nov 9, 2022
Next-generation of the non-destructive, node-based 2D image graphics editor

Non-destructive, node-based 2D image graphics editor written in Python, focused on simplicity, speed, elegance, and usability

Gimel Studio 214 Nov 9, 2022
spade is the next-generation networking command line tool.

spade is the next-generation networking command line tool. Say goodbye to the likes of dig, ping and traceroute with more accessible, more informative and prettier output.

Vivaan Verma 5 Jan 28, 2022
Hopefully the the next-generation backend server of bgm.tv

Hopefully the the next-generation backend server of bgm.tv

Bangumi 428 Nov 17, 2022
A next-generation CLI and TUI that aims to be your personal assistant for everything competitive programming related. 🚀

Competitive Programming Tool Kit The Competitive Programming Tool Kit (cptk for short), is a command line and terminal user interface (CLI and TUI) th

Alon 4 May 21, 2022
A Next Generation ConvNet by FaceBookResearch Implementation in PyTorch(Original) and TensorFlow.

ConvNeXt A Next Generation ConvNet by FaceBookResearch Implementation in PyTorch(Original) and TensorFlow. A FacebookResearch Implementation on A Conv

Raghvender 2 Feb 14, 2022
Pony Object Relational Mapper

Downloads Pony Object-Relational Mapper Pony is an advanced object-relational mapper. The most interesting feature of Pony is its ability to write que

null 3.1k Nov 18, 2022
Temporal-Relational CrossTransformers

Temporal-Relational Cross-Transformers (TRX) This repo contains code for the method introduced in the paper: Temporal-Relational CrossTransformers for

null 82 Nov 7, 2022